You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/11/01 07:37:41 UTC
groovy git commit: GROOVY-8369: Statically compiled property access
on enum class throws NoSuchFieldError (tweak tests - closes #625)
Repository: groovy
Updated Branches:
refs/heads/master 7b5851cb9 -> b23ef5394
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/b23ef539
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/b23ef539
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/b23ef539
Branch: refs/heads/master
Commit: b23ef5394e38a70804f4940e317d8677b50dade6
Parents: 7b5851c
Author: paulk <pa...@asert.com.au>
Authored: Wed Nov 1 17:37:12 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Wed Nov 1 17:37:33 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/b23ef539/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/b23ef539/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()
'''