Probable enum-related compiler bug
Jonathan Gibbons
Jonathan.Gibbons at Sun.COM
Fri Mar 5 16:26:28 PST 2010
FWIW, it also fails in jdk 1.6.0_17-b02, but works with jdk 1.7.0-ea-b83.
-- Jon
Dimitris Andreou wrote:
> 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
More information about the compiler-dev
mailing list