Bug 268308 - 3.4.2 breaks forward referencing to static final constants in enum
Summary: 3.4.2 breaks forward referencing to static final constants in enum
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-12 05:20 EDT by Nobody - feel free to take it CLA
Modified: 2009-03-12 13:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody - feel free to take it CLA 2009-03-12 05:20:11 EDT
Build ID: M20090211-1700

Steps To Reproduce:
See example code :

public enum Test
{
   
   TEST_ENUM(FORWARD_REF)

   private static final int FORWARD_REF = 0;

   private int i;
   private Test(int i)
   {
       this.i = i;
   }

}


More information:
The current (1.6 update 12) Sun compiler implementation allows this.

I believe problem is probably related to the fix for bug 255452 not checking for this case.
Comment 1 Olivier Thomann CLA 2009-03-12 09:04:35 EDT

*** This bug has been marked as a duplicate of bug 263877 ***
Comment 2 Frederic Fusier CLA 2009-03-12 12:34:23 EDT
This is not a duplicate, just an invalid forward reference rejected by all compilers...
Comment 3 Frederic Fusier CLA 2009-03-12 12:34:45 EDT
Close as INVALID
Comment 4 Frederic Fusier CLA 2009-03-12 12:43:50 EDT
I forgot to log the error I got while compiling comment 0 test case with Sun JDKs...

Using Sun JDK 6.0:
java version "1.6.0_14-ea"
Java(TM) SE Runtime Environment (build 1.6.0_14-ea-b01)
OpenJDK Client VM (build 14.0-b10, mixed mode)
Test.java:4: illegal forward reference
   TEST_ENUM(FORWARD_REF);
             ^
1 error

Using JDK 1.5.0:
java version "1.5.0_18-ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_18-ea-b01)
Java HotSpot(TM) Client VM (build 1.5.0_18-ea-b01, mixed mode)
Test.java:4: illegal forward reference
   TEST_ENUM(FORWARD_REF);
             ^
1 error
Comment 5 Frederic Fusier CLA 2009-03-12 12:46:31 EDT
(In reply to comment #4)
> I forgot to log the error I got while compiling comment 0 test case with Sun
> JDKs...
> 
Also forgot to mention that that test case was missing a ';' at the end of TEST_ENUM(FORWARD_REF) line and that I added it to avoid other noisy compilation errors...
Comment 6 Nobody - feel free to take it CLA 2009-03-12 12:50:58 EDT
My apologies. If i had double checked my code this bug would indeed have been a duplicate of 255452. My intention was to report the bug defined there.
Comment 7 Olivier Thomann CLA 2009-03-12 13:15:05 EDT
I guess you meant:
TEST_ENUM(Test.FORWARD_REF);
Closing as VERIFIED.
Comment 8 Nobody - feel free to take it CLA 2009-03-12 13:15:54 EDT
Yep...