Community
Participate
Working Groups
If you use the following code then code assist fails and an error is inserted into the log. --------------------------------------------------------------- import java.util.ArrayList; import java.util.List; /** * @author robert * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class Fred { public List<Integer> fred = new ArrayList<Integer>(); public void someMethod() { Integer val = fred.get(0); Integer x = fred.get(0); } public void someOtherMethod(final ACE value) { if } static enum ACE { A,C,E; } } --------------------------------------------------------------- The problem occurs if you position the cursor at the end of the "if" keyword in someOtherMethod() and use ctrl space. The result is the error: The command for the key you pressed failed with the following stack trace. --------------------------------------------------------------- java.lang.NullPointerException at org.eclipse.jdt.internal.codeassist.CompletionEngine.findTypeParameters(CompletionEngine.java:2761) at org.eclipse.jdt.internal.codeassist.CompletionEngine.findTypesAndPackages(CompletionEngine.java:2809) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:457) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:984) at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:124) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:201) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:195) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor.internalComputeCompletionProposals(JavaCompletionProcessor.java:358) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor.computeCompletionProposals(JavaCompletionProcessor.java:332) at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1472) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:242) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access $7(CompletionProposalPopup.java:238) at org.eclipse.jface.text.contentassist.CompletionProposalPopup $1.run(CompletionProposalPopup.java:197) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:192) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1320) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor $AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:180) at org.eclipse.ui.texteditor.ContentAssistAction $1.run(ContentAssistAction.java:82) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:141) at org.eclipse.ui.internal.commands.Command.execute(Command.java:132) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:471) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:889) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:930) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:548) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2 (WorkbenchKeyboard.java:496) at org.eclipse.ui.internal.keys.WorkbenchKeyboard $1.handleEvent(WorkbenchKeyboard.java:261) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1006) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:953) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:978) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:963) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:2337) at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:1816) at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:440) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1207) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3098) at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(Native Method) at org.eclipse.swt.widgets.Display.eventProc(Display.java:879) at org.eclipse.swt.internal.gtk.OS.gtk_main_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2297) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1377) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1348) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:254) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:96) at org.eclipse.core.internal.runtime.PlatformActivator $1.run(PlatformActivator.java:335) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) 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:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:183) at org.eclipse.core.launcher.Main.run(Main.java:644) at org.eclipse.core.launcher.Main.main(Main.java:628) --------------------------------------------------------------- The build ID is: eclipse.buildId=I200406251208
Addendum: I think it may be related to trying to invoke code templates after a compiler error. I think that any undefined class will cause this because I removed the enum declaration and still got the error.
*** This bug has been marked as a duplicate of 68981 ***