Jonathan Peterson created GROOVY-7747:
-----------------------------------------

             Summary: Generated Java stub for enum with abstract method is 
invalid
                 Key: GROOVY-7747
                 URL: https://issues.apache.org/jira/browse/GROOVY-7747
             Project: Groovy
          Issue Type: Bug
         Environment: Groovy 2.4.5
            Reporter: Jonathan Peterson
            Priority: Minor


When generating Java stub for enum with an abstract method results in invalid 
Java source. The generated source class is defined as "abstract enum".

{code:title=EnumWithAbstractMethod.groovy}
enum EnumWithAbstractMethod {
    ONE {
        @Override
        int getInt() {
            return 1
        }
    },
    TWO {
        @Override
        int getInt() {
            return 2
        }
    }

    abstract int getInt()
}
{code}

{code:title=Driver.groovy}
class Driver {

    public static void main(String[] args) {
        def stubCompiler = new JavaStubCompilationUnit(
            new CompilerConfiguration(),
            new GroovyClassLoader(),
            new File('tmp')
        )

        stubCompiler.addSource(new File('EnumWithAbstractMethod.groovy'))

        stubCompiler.compile()
    }
}
{code}

{code:title=EnumWithAbstractMethod.java}
public abstract enum EnumWithAbstractMethod
  implements
    groovy.lang.GroovyObject {
...
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to