Bug 81980 Unexpected unresolved enum quick fix suggestions [quick fix] [5.0]
Although the create field and create constant in my enum type suggestions for the quick fix in the code listed below compiles and works fine. It is not quite what I expected for the use of enumerated types. public class EnumQuickFixBug implements Runnable { private State state; private enum State {begin, end}; public void run() { state = State.begin; // Try quick fixing the line below state = State.middle; state = State.end; } public static void main(String args[]) { EnumQuickFixBug bugs = new EnumQuickFixBug(); bugs.run(); System.out.println("Done"); } } I expected to declaration of the enum type to change to something like: private enum State {begin, end, middle}; but instead it did something like this: private enum State {begin, end; public static State middle;};
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/UnresolvedVariablesQuickFixTest.java
private IJavaProject fJProject1;
	private IPackageFragmentRoot fSourceFolder;
	public UnresolvedVariablesQuickFixTest(String name) {
		super(name);
	}
	public static Test allTests() {
		return setUpTest(new TestSuite(THIS));
	}
	
	public static Test setUpTest(Test test) {
		return new ProjectTestSetup(test);
	}
	
	public static Test suite() {
		return allTests();
	}
	protected void setUp() throws Exception {
		Hashtable options= TestOptions.getFormatterOptions();
		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
		options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
		options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
		options.put(JavaCore.COMPILER_PB_UNUSED_IMPORT, JavaCore.IGNORE);		
		JavaCore.setOptions(options);			
		IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
		store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
		
		fJProject1= ProjectTestSetup.getProject();
		
		StubUtility.setCodeTemplate(CodeTemplateContextType.NEWTYPE_ID, "", null);