Probable enum-related compiler bug

Dimitris Andreou jim.andreou at gmail.com
Wed Feb 17 07:37:06 PST 2010


Hi all,

I have this:

public enum MyEnum implements Runnable {
    X() { public void run() { } },
}

and in another file:

public class Test {
    public static void main(String[] args) {
        MyEnum.X.run();
    }
}

Starting from a clean state, compiling it (using jdk 1.6.0_14) produces this
error:

Test.java:3: cannot find symbol
symbol  : method run()
location: class MyEnum
        MyEnum.X.run();
1 error

If I first compile MyEnum.java, and in a second step Test.java, no error is
produced.

The workaround I did to have a stable compilation is this:

public enum MyEnum implements Runnable {
    X() { public void run() { } },

    public abstract void run();
}


Is this a known bug?

Regards,
Dimitris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20100217/f04b4cdb/attachment.html 


More information about the compiler-dev mailing list