Bug 166570 - [assist] Proposal computer from the 'org.eclipse.mylar.java' plug-in did not complete normally
Summary: [assist] Proposal computer from the 'org.eclipse.mylar.java' plug-in did not ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M5   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-01 16:59 EST by Eugene Kuleshov CLA
Modified: 2007-02-05 11:19 EST (History)
1 user (show)

See Also:


Attachments
Fix with the null check (1.29 KB, patch)
2006-12-07 04:51 EST, David Audel CLA
no flags Details | Diff
Proposed fix (5.01 KB, patch)
2007-01-24 11:25 EST, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Kuleshov CLA 2006-12-01 16:59:01 EST
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)
Comment 1 Willian Mitsuda CLA 2006-12-01 19:35:35 EST
Humm... I saw this a couple of times, but never realized what it could be. Appears something random.
Comment 2 Mik Kersten CLA 2006-12-02 06:54:23 EST
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.
Comment 3 Eugene Kuleshov CLA 2006-12-02 13:19:08 EST
I is Eclipse 3.3M3. Should you reassign it to jdt inbox then?
Comment 4 Martin Aeschlimann CLA 2006-12-06 04:38:58 EST
Looks like a jdt.core problem.
Comment 5 David Audel CLA 2006-12-06 07:31:55 EST
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 ?
Comment 6 Mik Kersten CLA 2006-12-06 12:51:09 EST
I unfortunately do not, since I have never seen this bug.  Eugene?
Comment 7 Eugene Kuleshov CLA 2006-12-06 13:58:45 EST
(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.

Comment 8 David Audel CLA 2006-12-07 04:50:33 EST
I cannot reproduce the bug then i cannot fix it.
But i can add a null check to avoid NPE.
Comment 9 David Audel CLA 2006-12-07 04:51:00 EST
Created attachment 55200 [details]
Fix with the null check
Comment 10 David Audel CLA 2006-12-07 05:00:27 EST
Released for 3.3M4.

Now the bug could cause wrong completion proposals but won't cause exception.
Comment 11 Olivier Thomann CLA 2006-12-11 14:45:47 EST
Verified for 3.3M4 with I20061211-1119 by checking the source code.
Eugene, could you please verify that your test case is fixed? Thanks.
Comment 12 Eugene Kuleshov CLA 2006-12-14 10:49:46 EST
(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.

Comment 13 David Audel CLA 2007-01-24 11:24:34 EST
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;
	}
}
Comment 14 David Audel CLA 2007-01-24 11:25:03 EST
Created attachment 57440 [details]
Proposed fix
Comment 15 David Audel CLA 2007-01-24 11:27:19 EST
Released for 3.3M5

Test added
  CompletionTests#testCompletionVariableName35
Comment 16 Frederic Fusier CLA 2007-02-05 11:18:44 EST
Verified for 3.3 M5 using warm-up build I20070205-0009.