Bug 10986 - DOM/AST: NPE when trying to resolve a binding
Summary: DOM/AST: NPE when trying to resolve a binding
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-07 14:03 EST by Dirk Baeumer CLA
Modified: 2002-03-07 15:12 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 Dirk Baeumer CLA 2002-03-07 14:03:52 EST
Build 20020305

Test Case:

package errors_in;

public class A_test802 {
	public List g() {
		return null;
	}
	public void foo() {
		g();
	}
}

You get a NPE when trying to resolve the type binding for the expression 
representing the method call g(). 

Note that the CU has compile errors


java.lang.NullPointerException

Stack trace:
   java/lang/Throwable.<init>()V
   java/lang/Throwable.<init>(Ljava/lang/String;)V
   java/lang/NullPointerException.<init>(Ljava/lang/String;)V
   org/eclipse/jdt/core/dom/DefaultBindingResolver.resolveExpressionType
(Lorg/eclipse/jdt/core/dom/Expression;)Lorg/eclipse/jdt/core/dom/ITypeBinding;
   org/eclipse/jdt/core/dom/Expression.resolveTypeBinding()
Lorg/eclipse/jdt/core/dom/ITypeBinding;
   
org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.getReturn
Type()Lorg/eclipse/jdt/core/dom/Type;
   
org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.getSig
nature(Ljava/lang/String;)Ljava/lang/String;
   
org/eclipse/jdt/internal/ui/refactoring/code/ExtractMethodInputPage.updatePrevie
w(Ljava/lang/String;)V
   
org/eclipse/jdt/internal/ui/refactoring/code/ExtractMethodInputPage.textModified
(Ljava/lang/String;)V
   org/eclipse/jdt/internal/ui/refactoring/TextInputWizardPage.setVisible(Z)V
   org/eclipse/jface/wizard/WizardDialog.showStartingPage()V
   org/eclipse/jface/wizard/WizardDialog.createContents
(Lorg/eclipse/swt/widgets/Composite;)Lorg/eclipse/swt/widgets/Control;
   org/eclipse/jface/window/Window.create()V
   org/eclipse/jface/window/Window.open()I
   org/eclipse/jdt/internal/ui/refactoring/actions/RefactoringStarter.activate
(Lorg/eclipse/jdt/internal/corext/refactoring/base/Refactoring;Lorg/eclipse/jdt/
internal/ui/refactoring/RefactoringWizard;Ljava/lang/String;Z)V
   
org/eclipse/jdt/internal/ui/refactoring/actions/TextSelectionBasedRefactoringAct
ion.run()V
   org/eclipse/jdt/internal/ui/refactoring/actions/TextSelectionAction.run
(Lorg/eclipse/jface/action/IAction;)V
   org/eclipse/ui/internal/PluginAction.runWithEvent
(Lorg/eclipse/swt/widgets/Event;)V
   org/eclipse/jface/action/ActionContributionItem.handleWidgetSelection
(Lorg/eclipse/swt/widgets/Event;)V
   org/eclipse/jface/action/ActionContributionItem.handleWidgetEvent
(Lorg/eclipse/swt/widgets/Event;)V
   org/eclipse/jface/action/ActionContributionItem.access$0
(Lorg/eclipse/jface/action/ActionContributionItem;Lorg/eclipse/swt/widgets/Event
;)V
   org/eclipse/jface/action/ActionContributionItem$ActionListener.handleEvent
(Lorg/eclipse/swt/widgets/Event;)V
   org/eclipse/swt/widgets/EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)
V
   org/eclipse/swt/widgets/Widget.notifyListeners
(ILorg/eclipse/swt/widgets/Event;)V
   org/eclipse/swt/widgets/Display.runDeferredEvents()Z
   org/eclipse/swt/widgets/Display.readAndDispatch()Z
   org/eclipse/ui/internal/Workbench.runEventLoop()V
   org/eclipse/ui/internal/Workbench.run(Ljava/lang/Object;)Ljava/lang/Object;
   org/eclipse/core/internal/boot/InternalBootLoader.run
(Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;)
Ljava/lang/Object;
   org/eclipse/core/boot/BootLoader.run
(Ljava/lang/String;Ljava/net/URL;Ljava/lang/String;[Ljava/lang/String;)
Ljava/lang/Object;
   SlimLauncher.main([Ljava/lang/String;)V
Comment 1 Olivier Thomann CLA 2002-03-07 15:12:24 EST
g() was linked to a problem method binding. Then when I tried to get the IMethodBinding 
corresponding to g() I got null (which is the expected result). Then asking for the return type 
causes the NPE.
Fixed and released in HEAD.