Github user paulk-asert commented on a diff in the pull request: https://github.com/apache/groovy/pull/619#discussion_r147980977 --- Diff: src/test/gls/enums/EnumTest.groovy --- @@ -592,6 +592,80 @@ class EnumTest extends CompilableTestSupport { assert UsState.ID.toString() == 'Idaho' ''' } + + void testNestedEnumHasStaticModifier_GROOVY_8360() { + assertScript ''' + class Foo { + enum Bar { + X('x'), Y + String s + Bar(String s) { this.s = s } + Bar() {} + } + } + assert java.lang.reflect.Modifier.isStatic(Foo.Bar.modifiers) + assert Foo.Bar.X.s == 'x' + ''' + } + + void testEnumWithinInnerClassHasStaticModifier_GROOVY_8360() { + assertScript ''' + class Foo { + class Baz { + enum Bar { + X('x'), Y + String s + Bar(String s) { this.s = s } + Bar() {} + } + } + } + assert java.lang.reflect.Modifier.isStatic(Foo.Baz.Bar.modifiers) + assert Foo.Baz.Bar.X.s == 'x' + ''' + } + + void testNestedEnumHasStaticModifierSC_GROOVY_8360() { + assertScript ''' + @groovy.transform.CompileStatic + class Foo { + enum Bar { + X('x'), Y + String s + Bar(String s) { this.s = s } + Bar() {} + } + } + @groovy.transform.CompileStatic + void test() { + assert java.lang.reflect.Modifier.isStatic(Foo.Bar.getModifiers()) --- End diff -- I created GROOVY-8369 for this. I can't at first glance see a reason why we'd not support this with @CS.
---