groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shils <...@git.apache.org>
Subject [GitHub] groovy pull request #619: GROOVY-8360: Enums that are inner classes should h...
Date Tue, 24 Oct 2017 01:18:11 GMT
Github user shils commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/619#discussion_r146433436
  
    --- 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 --
    
    Unrelated to this issue - property style getter calls on Enum classes throw NoSuchFieldErrors
at runtime when statically compiled.


---

Mime
View raw message