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:01:30 UTC

[groovy] branch master updated: GROOVY-9511: Annotation spanning lines is not supported by Parrot

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f955ae8  GROOVY-9511: Annotation spanning lines is not supported by Parrot
f955ae8 is described below

commit f955ae8e5f288646365478fa16262c40d9e3968e
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
---
 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> ()
+}