Bug 266466 - [1.5][compiler] Wrong Error "Cannot reference a field before it is definied" in enums since 3.4.2
Summary: [1.5][compiler] Wrong Error "Cannot reference a field before it is definied" ...
Status: VERIFIED DUPLICATE of bug 263877
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-27 06:13 EST by max schroeder CLA
Modified: 2009-03-10 15:03 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 max schroeder CLA 2009-02-27 06:13:12 EST
Since the latest update I got a compiler error whereas I didn't get one in 3.4.1
Eclipse complains about the usage of an static field declared in an enum in the constructor of an enum instance. look at the following code:

public class Demo
{	
	public static class CLAZZ
	{
		public static CLAZZ demo = new CLAZZ(CLAZZ.test);
		
		public CLAZZ(String string)
		{
			myString = string;
		}
		
		public static String test = "test";
		
		final String myString;
	}
	
	public static enum ENUM
	{
		
		TEST1(ENUM.test);
		
		private ENUM(String string)
		{
			myString = string;
		}
		
		public static String test = "test";
		
		final String myString;
	}
	
}

The CLAZZ doesn't show the error, where the ENUM tells me about the error on the declaration of the sole instance. My javac dosen't bother about this class and so should the eclipse compiler...
Comment 1 Olivier Thomann CLA 2009-02-27 08:30:25 EST

*** This bug has been marked as a duplicate of bug 263877 ***
Comment 2 Frederic Fusier CLA 2009-03-10 15:03:42 EDT
Verified for 3.5M6 using I20090310-0100.