Probable enum-related compiler bug
Joseph D. Darcy
Joe.Darcy at Sun.COM
Mon Mar 8 17:30:10 PST 2010
Jonathan Gibbons wrote:
> Known issue, see http://bugs.sun.com/view_bug.do?bug_id=6724345
> Fixed in JDK 7 b39.
And if you're on Linux, this fix will be included in OpenJDK 6 b19.
-Joe
>
> -- 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