Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337706 - NPE when triggering templates completion after 'new'
Summary: NPE when triggering templates completion after 'new'
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Recommenders (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stefan Henss CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-21 06:46 EST by Marcel Bruch CLA
Modified: 2019-07-24 14:36 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Bruch CLA 2011-02-21 06:46:29 EST
Triggering templates completion in:

public class MyDialog extends Dialog {

	private Text swtTextWidget;

	@Override
	protected Control createDialogArea(final Composite parent) {
		final Composite container = createContainer(parent);

		swtTextWidget = new <^Space>
	}

	private Composite createContainer(final Composite parent) {
		final Composite container = new Composite(parent, SWT.NONE);
		container.setLayout(null);
		return container;
	}

	protected MyDialog(final IShellProvider parentShell) {
		super(parentShell);
	}
}


results in:


The 'Code Recommenders Calls Proposals' proposal computer from the 'org.eclipse.recommenders.rcp.codecompletion.templates' plug-in did not complete normally. The extension has thrown a runtime exception.

java.lang.NullPointerException
at org.eclipse.recommenders.internal.rcp.codecompletion.templates.CompletionTargetVariableBuilder.needsConstructor(CompletionTargetVariableBuilder.java:97)
at org.eclipse.recommenders.internal.rcp.codecompletion.templates.CompletionTargetVariableBuilder.createInvokedVariable(CompletionTargetVariableBuilder.java:44)
at org.eclipse.recommenders.internal.rcp.codecompletion.templates.TemplatesCompletionProposalComputer.computeProposals(TemplatesCompletionProposalComputer.java:120)
at org.eclipse.recommenders.internal.rcp.codecompletion.templates.TemplatesCompletionProposalComputer.computeCompletionProposals(TemplatesCompletionProposalComputer.java:107)
at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:316)
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:286)
at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:246)
at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1834)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:556)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:553)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:488)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:482)
at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1660)
at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:182)
at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
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:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1031)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3775)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1367)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1390)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1375)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1404)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1400)
at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:416)
at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:958)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5068)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:56)
at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:587)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4978)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:1943)
at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2025)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5040)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4582)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4659)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:115)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3274)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)



Can you fix this in master?
Comment 1 Stefan Henss CLA 2011-02-21 21:52:17 EST
It's just a quick fix to prevent the NPEs. Will further analyze how you might get templates from this context, otherwise I will cancel the computation ASAP.
Comment 2 Marcel Bruch CLA 2012-02-02 01:41:42 EST
Closing this issue. Please give latest dev build (v0.5) a try:

http://download.eclipse.org/recommenders/updates/dev/e37/
http://download.eclipse.org/recommenders/updates/dev/e42/
Comment 3 Marcel Bruch CLA 2012-02-02 01:41:57 EST
Closing this issue. Please give latest dev build (v0.5) a try:

http://download.eclipse.org/recommenders/updates/dev/e37/
http://download.eclipse.org/recommenders/updates/dev/e42/