Bug 50686 - NPE in MethodScope.createMethod
Summary: NPE in MethodScope.createMethod
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-27 11:10 EST by Dani Megert CLA
Modified: 2004-05-18 11:29 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2004-01-27 11:10:00 EST
I20040121 + newest J Core

I had this NPE in .log - no steps (there was nothing visible in the UI)

!ENTRY org.eclipse.ui 4 0 Jan 27, 2004 15:02:49.277
!MESSAGE Action for command 'org.eclipse.ui.edit.text.contentAssist.proposals'
failed to execute properly.
!STACK 0
java.lang.NullPointerException
	at
org.eclipse.jdt.internal.compiler.lookup.MethodScope.createMethod(MethodScope.java:299)
	at
org.eclipse.jdt.internal.compiler.lookup.ClassScope.buildMethods(ClassScope.java:220)
	at
org.eclipse.jdt.internal.compiler.lookup.ClassScope.buildFieldsAndMethods(ClassScope.java:124)
	at
org.eclipse.jdt.internal.compiler.lookup.ClassScope.buildFieldsAndMethods(ClassScope.java:132)
	at
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.buildFieldsAndMethods(CompilationUnitScope.java:61)
	at
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:224)
	at
org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:800)
	at org.eclipse.jdt.internal.core.BinaryType.codeComplete(BinaryType.java:90)
	at org.eclipse.jdt.internal.core.BinaryType.codeComplete(BinaryType.java:57)
	at
org.eclipse.jdt.internal.debug.ui.display.DetailsCompletionProcessor.computeCompletionProposals(DetailsCompletionProcessor.java:85)
	at
org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1433)
	at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:231)
	at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$7(CompletionProposalPopup.java:227)
	at
org.eclipse.jface.text.contentassist.CompletionProposalPopup$1.run(CompletionProposalPopup.java:190)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84)
	at
org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:185)
	at
org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1285)
	at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:633)
	at org.eclipse.ui.console.actions.TextViewerAction.run(TextViewerAction.java:61)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:881)
	at org.eclipse.ui.internal.commands.ActionHandler.execute(ActionHandler.java:40)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:414)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:778)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:815)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:505)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2(WorkbenchKeyboard.java:444)
	at
org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent(WorkbenchKeyboard.java:233)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:699)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:832)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:857)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842)
	at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1716)
	at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1712)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3037)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:2940)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:2865)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1371)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2019)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1530)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1506)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:265)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:47)
	at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:248)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:85)
	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:279)
	at org.eclipse.core.launcher.Main.run(Main.java:742)
	at org.eclipse.core.launcher.Main.main(Main.java:581)
Comment 1 David Audel CLA 2004-01-28 08:15:43 EST
I can reproduce the bug in build I20040120.

Test case:
1) create a test.jar with the following content.
X.class
public interface X {
  public class Y {
    public void foo(Object o) {
      System.out.println();
    }
  }
}
2) create a testsrc.zip file with the X.java.
3) create a java project P.
4) add test.jar on the classpath and attach testsrc.zip.
5) create Test.java.
public class Test {
  public static void main(String[] args) {
    X x = new X(){};
    new X.Y().foo(null);//breakpoint
  }
}
6) place a breakpoint.
7) execute Test as application in debug mode.
8) step inside foo() method.
9) place cursor in the Display view.
10) do ctrl+space.
.log contain the NPE.
Comment 2 David Audel CLA 2004-05-14 07:26:00 EDT
*** Bug 62201 has been marked as a duplicate of this bug. ***
Comment 3 David Audel CLA 2004-05-14 08:09:18 EDT
Fixed and test added
  SnippetCompletionTests#testCodeSnippetAssistForClassFileInInterface()
Comment 4 Olivier Thomann CLA 2004-05-18 11:29:31 EDT
Verified in 200405180816