groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sh...@apache.org
Subject groovy git commit: GROOVY-7342 Last enum value is hidden if annotated * Try syntactic predicate for enum constant before predicate for end of enum constants Closes #194
Date Sat, 16 Jan 2016 20:01:59 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 477ab7641 -> 7a2baa556


GROOVY-7342 Last enum value is hidden if annotated
* Try syntactic predicate for enum constant before predicate for end of enum constants
Closes #194


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/7a2baa55
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/7a2baa55
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/7a2baa55

Branch: refs/heads/GROOVY_2_4_X
Commit: 7a2baa55632791124dc072a70f4a43133c62a376
Parents: 477ab76
Author: Shil Sinha <shil.sinha@gmail.com>
Authored: Tue Nov 24 12:00:39 2015 -0500
Committer: Shil Sinha <shils@apache.org>
Committed: Sat Jan 16 14:42:49 2016 -0500

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/antlr/groovy.g |  4 ++--
 src/test/gls/enums/EnumTest.groovy          | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/7a2baa55/src/main/org/codehaus/groovy/antlr/groovy.g
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/antlr/groovy.g b/src/main/org/codehaus/groovy/antlr/groovy.g
index 9681954..aadf519 100644
--- a/src/main/org/codehaus/groovy/antlr/groovy.g
+++ b/src/main/org/codehaus/groovy/antlr/groovy.g
@@ -1233,9 +1233,9 @@ enumConstants
             (nls (RCURLY | classField)) => { break; /* leave ()* loop */ }
         |   nls! COMMA!
             (
-                (nls (RCURLY | classField)) => { break; /* leave ()* loop */ }
-            |
                 (nls annotationsOpt IDENT) => nls! enumConstant
+            |
+                (nls (RCURLY | classField)) => { break; /* leave ()* loop */ }
             )
         )*
     ;

http://git-wip-us.apache.org/repos/asf/groovy/blob/7a2baa55/src/test/gls/enums/EnumTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/gls/enums/EnumTest.groovy b/src/test/gls/enums/EnumTest.groovy
index 47b61f2..8f9c152 100644
--- a/src/test/gls/enums/EnumTest.groovy
+++ b/src/test/gls/enums/EnumTest.groovy
@@ -556,6 +556,27 @@ class EnumTest extends CompilableTestSupport {
             println Test.TEST1.info == [1,2,3]
         '''
     }
+
+    void testLastEnumValueIsAnnotatedWithoutTrailingComma_GROOVY_7342() {
+        assertScript '''
+            import java.lang.annotation.ElementType;
+            import java.lang.annotation.Target;
+
+            @Target([ElementType.FIELD])
+            @interface Fooann {
+            }
+
+            enum Foonum {
+                @Fooann
+                X,
+                @Fooann
+                Y
+            }
+
+            println Foonum.X
+            println Foonum.Y
+        '''
+    }
 }
 
 enum UsCoin {


Mime
View raw message