You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/04/16 15:09:33 UTC

[groovy] branch GROOVY_3_0_X updated (87d2ca7 -> dd6bebe)

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a change to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git.


    from 87d2ca7  GROOVY-9505: improve comment
     new f7b3159  Cache gradle repository to speed-up github actions builds.
     new f734496  Trivial refactoring: extract common variable
     new dd6bebe  GROOVY-9511: Annotation spanning lines is not supported by Parrot

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/gradle.yml                       | 12 ++++++++++
 src/antlr/GroovyParser.g4                          |  2 +-
 .../org/codehaus/groovy/vmplugin/v8/Selector.java  |  8 ++++---
 .../groovy/parser/antlr4/GroovyParserTest.groovy   |  4 ++++
 .../test/resources/bugs/BUG-GROOVY-9511.groovy}    | 28 ++++++++++++++++------
 5 files changed, 43 insertions(+), 11 deletions(-)
 copy subprojects/{groovy-dateutil/build.gradle => parser-antlr4/src/test/resources/bugs/BUG-GROOVY-9511.groovy} (60%)


[groovy] 02/03: Trivial refactoring: extract common variable

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit f73449605bb7ba0e25339d6a69f7b65fecc260fd
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu Apr 16 19:04:53 2020 +0800

    Trivial refactoring: extract common variable
    
    (cherry picked from commit 27bac45a4392abbe7cd2520c3d0a0669df946f08)
---
 src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java b/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
index 6741689..f0761e1 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v8/Selector.java
@@ -930,17 +930,19 @@ public abstract class Selector {
             Class<?>[] pt = handle.type().parameterArray();
             for (int i = 0; i < args.length; i++) {
                 Object arg = args[i];
+                Class<?> paramType = pt[i];
                 MethodHandle test;
+
                 if (arg == null) {
-                    test = IS_NULL.asType(MethodType.methodType(boolean.class, pt[i]));
+                    test = IS_NULL.asType(MethodType.methodType(boolean.class, paramType));
                     if (LOG_ENABLED) LOG.info("added null argument check at pos " + i);
                 } else {
                     Class<?> argClass = arg.getClass();
-                    if (pt[i].isPrimitive()) continue;
+                    if (paramType.isPrimitive()) continue;
                     //if (Modifier.isFinal(argClass.getModifiers()) && TypeHelper.argumentClassIsParameterClass(argClass,pt[i])) continue;
                     test = SAME_CLASS.
                             bindTo(argClass).
-                            asType(MethodType.methodType(boolean.class, pt[i]));
+                            asType(MethodType.methodType(boolean.class, paramType));
                     if (LOG_ENABLED) LOG.info("added same class check at pos " + i);
                 }
                 Class<?>[] drops = new Class[i];


[groovy] 01/03: Cache gradle repository to speed-up github actions builds.

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit f7b3159f1f26c36bd41c57dddcbeee4a720e222f
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Mon Apr 13 11:04:46 2020 +0200

    Cache gradle repository to speed-up github actions builds.
    
    (cherry picked from commit 2967e3d49c67573fa1c7ea3dea93ee77d373c404)
---
 .github/workflows/gradle.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index caa7b18..fd6a4c5 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -31,6 +31,12 @@ jobs:
         uses: actions/setup-java@v1
         with:
           java-version: ${{ matrix.java }}
+      - name: Cache Gradle Repository
+        uses: actions/cache@v1
+        with:
+          path: ~/.gradle/caches
+          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
+          restore-keys: ${{ runner.os }}-gradle
       - name: Test with Gradle
         run: ./gradlew test
         timeout-minutes: 60
@@ -49,6 +55,12 @@ jobs:
         uses: actions/setup-java@v1
         with:
           java-version: ${{ matrix.java }}
+      - name: Cache Gradle Repository
+        uses: actions/cache@v1
+        with:
+          path: ~/.gradle/caches
+          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
+          restore-keys: ${{ runner.os }}-gradle
       - name: Test with Gradle
         run: ./gradlew testWithIndy
         timeout-minutes: 60


[groovy] 03/03: GROOVY-9511: Annotation spanning lines is not supported by Parrot

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit dd6bebe5b6687652851bda6945b3f471da86430f
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu Apr 16 22:38:16 2020 +0800

    GROOVY-9511: Annotation spanning lines is not supported by Parrot
    
    (cherry picked from commit f955ae8e5f288646365478fa16262c40d9e3968e)
---
 src/antlr/GroovyParser.g4                          |  2 +-
 .../groovy/parser/antlr4/GroovyParserTest.groovy   |  4 +++
 .../src/test/resources/bugs/BUG-GROOVY-9511.groovy | 42 ++++++++++++++++++++++
 3 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index a126114..39c4186 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -509,7 +509,7 @@ annotationsOpt
     ;
 
 annotation
-    :   AT annotationName ( LPAREN elementValues? rparen)?
+    :   AT annotationName (nls LPAREN elementValues? rparen)?
     ;
 
 elementValues
diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
index aefac72..e81633c 100644
--- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
+++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/GroovyParserTest.groovy
@@ -454,4 +454,8 @@ final class GroovyParserTest extends GroovyTestCase {
     void "test groovy core - GROOVY-9449"() {
         doTest('bugs/BUG-GROOVY-9449.groovy');
     }
+
+    void "test groovy core - GROOVY-9511"() {
+        doTest('bugs/BUG-GROOVY-9511.groovy', [MethodNode]);
+    }
 }
diff --git a/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-9511.groovy b/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-9511.groovy
new file mode 100644
index 0000000..6c1b4d2
--- /dev/null
+++ b/subprojects/parser-antlr4/src/test/resources/bugs/BUG-GROOVY-9511.groovy
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+@interface CollectionOfElements{}
+@interface JoinTable{
+    Table table()
+    JoinColumn[] joinColumns()
+}
+@interface Table{ String name() }
+@interface JoinColumn{ String name() }
+@interface Column{
+    String name()
+    boolean nullable()
+}
+
+class OtherSection {
+    @CollectionOfElements
+    @JoinTable
+            (
+                    table = @Table(name="gaga"),
+                    joinColumns = @JoinColumn(name="BoyId")
+            )
+    @Column(name="favoritepoupon",
+            nullable=false)
+    Set<String> questions = new HashSet<String> ()
+}