Bug 109969 error while computing quick fixes: java.lang.ClassCastException: org.eclipse.jdt.core.dom.FieldAccess
Version: 3.1.0 Build id: I20050920-0010 Setting the cursor to any position on the line: this.bar= bar; in package pack11; public class Test1 { int bar; public void foo() { this.bar= bar; } } and then call quick fix (ctrl-1) I get following exception: java.lang.ClassCastException: org.eclipse.jdt.core.dom.FieldAccess at org.eclipse.jdt.internal.ui.text.correction.LocalCorrectionsSubProcessor.getAssi gnmentHasNoEffectProposals(LocalCorrectionsSubProcessor.java:924) at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.process (QuickFixProcessor.java:493) at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.getCorrections (QuickFixProcessor.java:215) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrecti onCollector.safeRun(JavaCorrectionProcessor.java:310) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrecti onProcessorAccess.run(JavaCorrectionProcessor.java:275) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:1044) at org.eclipse.core.runtime.Platform.run(Platform.java:783) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrecti onProcessorAccess.process(JavaCorrectionProcessor.java:265) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorre ctions(JavaCorrectionProcessor.java:392) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectPropo sals(JavaCorrectionProcessor.java:216) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.computeCompl etionProposals(JavaCorrectionProcessor.java:179) at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals (ContentAssistant.java:1558) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals (CompletionProposalPopup.java:349) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$15 (CompletionProposalPopup.java:346) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run (CompletionProposalPopup.java:293) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals (CompletionProposalPopup.java:287) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions (ContentAssistant.java:1405) at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionAssistant.showPossible Completions(JavaCorrectionAssistant.java:168) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer .doOperation(CompilationUnitEditor.java:210) at org.eclipse.ui.texteditor.TextOperationAction$1.run (TextOperationAction.java:122) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.texteditor.TextOperationAction.run (TextOperationAction.java:120) at org.eclipse.jface.action.Action.runWithEvent(Action.java:996) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:182) at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute (LegacyHandlerWrapper.java:108) at org.eclipse.core.commands.Command.execute(Command.java:311) at org.eclipse.core.commands.ParameterizedCommand.execute (ParameterizedCommand.java:397) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand (WorkbenchKeyboard.java:459) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press (WorkbenchKeyboard.java:781) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent (WorkbenchKeyboard.java:828) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings (WorkbenchKeyboard.java:550) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3 (WorkbenchKeyboard.java:493) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent (WorkbenchKeyboard.java:117) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:971) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:883) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:908) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:893) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:921) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:917) at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1516) at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:3376) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3087) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3830) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1679) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2821) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1755) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1719) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.java:368) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:377) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
JavaCore.setOptions(hashtable);
				
		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
		StringBuffer buf= new StringBuffer();
		buf.append("package test1;\n");
		buf.append("public class E {\n");
		buf.append("    private int count;\n");
		buf.append("    public E(int i) {\n");
		buf.append("        class Inner {\n");
		buf.append("            public void foo() {\n");
		buf.append("               count= 1;\n");
		buf.append("            }\n");
		buf.append("        }\n");
		buf.append("    }\n");
		buf.append("}\n");
		ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);
		CompilationUnit astRoot= getASTRoot(cu);
		ArrayList proposals= collectCorrections(cu, astRoot);
		assertNumberOfProposals(proposals, 1);
		assertCorrectLabels(proposals);
		CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
		String preview= getPreviewContent(proposal);
		buf= new StringBuffer();
		buf.append("package test1;\n");
		buf.append("public class E {\n");
		buf.append("    private int count;\n");
		buf.append("    public E(int i) {\n");
		buf.append("        class Inner {\n");
		buf.append("            public void foo() {\n");
		buf.append("               E.this.count= 1;\n");