alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (GroovyInnerEnumBug.groovy)

This example Groovy source code file (GroovyInnerEnumBug.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

direction3979, direction3979, east, enumset, enumtest2, groovyinnerenumbug, groovytestcase, myenum, myenum, north, south, south, west, west

The Groovy GroovyInnerEnumBug.groovy source code

package groovy.bugs

class GroovyInnerEnumBug extends GroovyTestCase {
    static public enum MyEnum { 
        a, b, c
        public static MyEnum[] myenums = [a, b, c];
    }
    
    // GROOVY-3979
    void testEnumInsideAClass3979() {
        assertScript """
            class EnumTest2 {
                enum Direction3979 { North, East, South, West }
                static void main(args) {
                    for (d in Direction3979) { 
                        assert d instanceof Direction3979
                    }
                }
            }
        """
    }

    // GROOVY-3994
    void testEnumInsideAClass3994() {
        assert MyEnum.a.name() == 'a'
        assertTrue Enum.isAssignableFrom(MyEnum.class)
        assert EnumSet.allOf(MyEnum.class) instanceof EnumSet 
    }
}

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy GroovyInnerEnumBug.groovy source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.