Bug 5065 - NullPointerException in Code Assist
Summary: NullPointerException in Code Assist
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 98
: P3 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-18 01:34 EDT by Carolyn MacLeod CLA
Modified: 2002-01-11 09:04 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carolyn MacLeod CLA 2001-10-18 01:34:38 EDT
- Create a test class
- import org.eclipse.swt.widgets
- Type the following code into a method, except for the stuff in <...>
- Place your text cursor where indicated
- Type ctrl+space to activate code assist

	Display testDisplay = new Display();
	testDisplay.disposeExec(new Runnable() {
		<place cursor here and type ctrl-space>
	});

The walkback follows:
Log: Thu Oct 18 01:26:01 EDT 2001
1 org.eclipse.core.resources 4 Unhandled exception caught in event loop.
Log: Thu Oct 18 01:26:01 EDT 2001
4 org.eclipse.ui 0 java.lang.NullPointerException
java.lang.NullPointerException
	at 
org.eclipse.jdt.internal.codeassist.CompletionEngine.findLocalMethodDeclarations
(CompletionEngine.java(Compiled Code))
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.findMethods
(CompletionEngine.java:1490)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete
(CompletionEngine.java:270)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete
(CompletionEngine.java:540)
	at org.eclipse.jdt.internal.core.Openable.codeComplete
(Openable.java:112)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete
(CompilationUnit.java:61)
	at 
org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor.computeCompletionP
roposals(JavaCompletionProcessor.java:97)
	at 
org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals
(ContentAssistant.java:1064)
	at 
org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals
(CompletionProposalPopup.java:84)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$0
(CompletionProposalPopup.java:82)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$1.run
(CompletionProposalPopup.java:62)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java
(Compiled Code))
	at 
org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals
(CompletionProposalPopup.java:59)
	at 
org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions
(ContentAssistant.java:999)
	at org.eclipse.jface.text.source.SourceViewer.doOperation
(SourceViewer.java:367)
	at org.eclipse.ui.texteditor.TextOperationAction.run
(TextOperationAction.java:61)
	at org.eclipse.ui.texteditor.RetargetTextEditorAction.run
(RetargetTextEditorAction.java:103)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:451)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java(Compiled Code))
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java(Compiled Code))
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java(Compiled Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled 
Code))
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:658)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:820)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:433)
	at org.eclipse.core.launcher.Main.main(Main.java:306)
Comment 1 Carolyn MacLeod CLA 2001-10-18 01:37:44 EDT
Continuing from the steps above, I started to type the run method.
When I typed the '(' I got another, different walkback.

	Display testDisplay = new Display();
	testDisplay.disposeExec(new Runnable() {
		public void run(
	});

Log: Thu Oct 18 01:32:28 EDT 2001
1 org.eclipse.core.resources 4 Unhandled exception caught in event loop.
Log: Thu Oct 18 01:32:28 EDT 2001
4 org.eclipse.ui 0 Failed to execute runnable
org.eclipse.swt.SWTException: Failed to execute runnable
	at org.eclipse.swt.SWT.error(SWT.java:1805)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages
(Synchronizer.java(Compiled Code))
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java
(Compiled Code))
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java
(Compiled Code))
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:658)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:820)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:433)
	at org.eclipse.core.launcher.Main.main(Main.java:306)
Comment 2 Philipe Mulet CLA 2001-10-18 06:28:49 EDT
Was missing a null check for completions in empty anonymous type.
Fixed