Community
Participate
Working Groups
There probably lots of factors that affect this. But I think that generally Mylar should catch any exceptions from java model, log them and return an empty result, even if it is originally JDT fault. -- Error Log -- Date: Fri Dec 01 16:53:28 EST 2006 Message: The 'org.eclipse.mylar.java.javaNoTypeCompletionProposalComputer' proposal computer from the 'org.eclipse.mylar.java' plug-in did not complete normally. The extension has thrown a runtime exception. Severity: Warning Plugin ID: org.eclipse.jdt.ui Stack Trace: java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.util.SimpleSet.includes(SimpleSet.java:79) at org.eclipse.jdt.internal.codeassist.UnresolvedReferenceNameFinder.acceptName(UnresolvedReferenceNameFinder.java:61) at org.eclipse.jdt.internal.codeassist.UnresolvedReferenceNameFinder.endVisitPreserved(UnresolvedReferenceNameFinder.java:415) at org.eclipse.jdt.internal.codeassist.UnresolvedReferenceNameFinder.endVisit(UnresolvedReferenceNameFinder.java:314) at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:246) at org.eclipse.jdt.internal.codeassist.UnresolvedReferenceNameFinder.find(UnresolvedReferenceNameFinder.java:76) at org.eclipse.jdt.internal.codeassist.CompletionEngine.findVariableFromUnresolvedReference(CompletionEngine.java:6289) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:1300) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:1943) at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:123) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:314) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:307) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.internalComputeCompletionProposals(JavaCompletionProposalComputer.java:171) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.computeCompletionProposals(JavaCompletionProposalComputer.java:147) at org.eclipse.mylar.internal.java.ui.editor.MylarJavaNoTypeProposalComputer.computeCompletionProposals(MylarJavaNoTypeProposalComputer.java:39) at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:303) at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:264) at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:251) at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:220) at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1754) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:479) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:476) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$12.run(CompletionProposalPopup.java:1400) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.incrementalComplete(CompletionProposalPopup.java:1394) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1582) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:181) at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80) at org.eclipse.jface.action.Action.runWithEvent(Action.java:499) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185) at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:461) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:424) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:160) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:465) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:791) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:838) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:563) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:505) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:122) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1005) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:924) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:949) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:934) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:962) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:958) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1272) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3468) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3368) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4132) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1990) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3075) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1924) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1888) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165) 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:341) at org.eclipse.core.launcher.Main.basicRun(Main.java:285) at org.eclipse.core.launcher.Main.run(Main.java:987) at org.eclipse.core.launcher.Main.main(Main.java:962)
Humm... I saw this a couple of times, but never realized what it could be. Appears something random.
In all such cases we always avoid modifying the exception contract of the JDT parts that we extend. Without Mylar JDT would throw this exception, so it should throw it with Mylar. Although the Mylar processor is blamed, we have not done any additional computation at this stage. So moving to JDT since error appears to be on that end. Fyi the error gets thrown from the MylarJavaNoTypeProposalComputer which extends JavaNoTypeCompletionProposalComputer. @Override public List computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) { --> List proposals = super.computeCompletionProposals(context, monitor); return MylarJavaProposalProcessor.getDefault().projectInterestModel(this, proposals); } Eugene: please post the Eclipse version you saw this with.
I is Eclipse 3.3M3. Should you reassign it to jdt inbox then?
Looks like a jdt.core problem.
I don't find a test case to reproduce the bug. The bug is caused by a completion inside a variable name. public class X { void foo() { ??? int bar| // do ctrl + space at | ??? } } Do you have a test case to reproduce the problem ?
I unfortunately do not, since I have never seen this bug. Eugene?
(In reply to comment #6) > I unfortunately do not, since I have never seen this bug. Eugene? No. I don't have test case. It happens randomly from time to time.
I cannot reproduce the bug then i cannot fix it. But i can add a null check to avoid NPE.
Created attachment 55200 [details] Fix with the null check
Released for 3.3M4. Now the bug could cause wrong completion proposals but won't cause exception.
Verified for 3.3M4 with I20061211-1119 by checking the source code. Eugene, could you please verify that your test case is fixed? Thanks.
(In reply to comment #11) > Verified for 3.3M4 with I20061211-1119 by checking the source code. > Eugene, could you please verify that your test case is fixed? Thanks. I don't have completely reproduceable test case. Will keep an eye on this after M4 release.
Jerome found a test case that reproduce the NPE with 3.3M3. I reopen the bug and will add a real fix for this bug. The test case is: package p; import q.ZZZ; public class X { public static void foo() { ZZZ[] zzz| // do ctrl + space at | int zzzzzz = -1; } }
Created attachment 57440 [details] Proposed fix
Released for 3.3M5 Test added CompletionTests#testCompletionVariableName35
Verified for 3.3 M5 using warm-up build I20070205-0009.