groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [2/4] groovy git commit: GROOVY-8369: Statically compiled property access on enum class throws NoSuchFieldError (tweak tests - closes #625)
Date Wed, 01 Nov 2017 09:08:37 GMT
 GROOVY-8369: Statically compiled property access on enum class throws NoSuchFieldError (tweak
tests - closes #625)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 7587ecbf99a19bdcd9d432a0885381ffb0f6a4fd
Parents: 950c2c2
Author: paulk <paulk@asert.com.au>
Authored: Wed Nov 1 17:37:12 2017 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Wed Nov 1 19:08:20 2017 +1000

----------------------------------------------------------------------
 src/test/gls/enums/EnumTest.groovy                       | 11 +++++++++++
 .../asm/sc/FieldsAndPropertiesStaticCompileTest.groovy   |  3 +--
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/7587ecbf/src/test/gls/enums/EnumTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/gls/enums/EnumTest.groovy b/src/test/gls/enums/EnumTest.groovy
index f858dfd..a0a4d8c 100644
--- a/src/test/gls/enums/EnumTest.groovy
+++ b/src/test/gls/enums/EnumTest.groovy
@@ -592,6 +592,17 @@ class EnumTest extends CompilableTestSupport {
             assert UsState.ID.toString() == 'Idaho'
         '''
     }
+
+    void testEnumConstantsTakePrecedenceOverClassProperties() {
+        assertScript '''
+            @Deprecated
+            enum Foo {
+                annotations
+            }
+            assert 'annotations' == Foo.annotations.toString()
+            assert Foo.getAnnotations().size() == 1
+          '''
+    }
 }
 
 enum UsCoin {

http://git-wip-us.apache.org/repos/asf/groovy/blob/7587ecbf/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
b/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
index 2bf0a86..eef6232 100644
--- a/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
+++ b/src/test/org/codehaus/groovy/classgen/asm/sc/FieldsAndPropertiesStaticCompileTest.groovy
@@ -704,8 +704,7 @@ import org.codehaus.groovy.transform.sc.ListOfExpressionsExpression
                 enum Foo {}
 
                 def test() {
-                    println Foo.getModifiers() // => 16401 // ENUM | FINAL | PUBLIC (see
GROOVY_8360 wrt STATIC)
-                    println Foo.modifiers      // java.lang.NoSuchFieldError: modifiers
+                    assert Foo.getModifiers() == Foo.modifiers
                 }    
                 test()
             '''


Mime
View raw message