Probable enum-related compiler bug

Jonathan Gibbons Jonathan.Gibbons at Sun.COM
Fri Mar 5 16:34:20 PST 2010


Known issue, see http://bugs.sun.com/view_bug.do?bug_id=6724345
Fixed in JDK 7 b39.

-- Jon


Jonathan Gibbons wrote:
> 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