Bug 47795 - NPE selecting method in anonymous 2 level deep
Summary: NPE selecting method in anonymous 2 level deep
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M6   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-01 08:03 EST by Jerome Lanneluc CLA
Modified: 2003-12-17 07:05 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 Jerome Lanneluc CLA 2003-12-01 08:03:15 EST
Build 20031126 + latest JDT Core

1. Create the following class:
public class X {
	X(Object arg) {
	}
	void foo() {
		new X("") {
			void bar() {
				new Object() {
					void selectMe() {
					}
				};
			}
		};
	}
}
2. Select 'selectMe()' and press F3
Observe: You get the following NPE:
java.lang.NullPointerException
        at org.eclipse.jdt.internal.core.Util.typeSignature(Util.java:1490)
        at org.eclipse.jdt.internal.core.Util.typeParameterSignatures
(Util.java:1478)
        at org.eclipse.jdt.internal.core.util.HandleFactory$1$Visitor.visit
(HandleFactory.java:184)
        at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.traverse
(ConstructorDeclaration.java:435)
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse
(TypeDeclaration.java:1066)
        at 
org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse
(QualifiedAllocationExpression.java:342)
        at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse
(MethodDeclaration.java:160)
        at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse
(TypeDeclaration.java:1022)
        at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse
(CompilationUnitDeclaration.java:305)
        at org.eclipse.jdt.internal.core.util.HandleFactory.createElement
(HandleFactory.java:296)
        at org.eclipse.jdt.internal.core.SelectionRequestor.acceptLocalMethod
(SelectionRequestor.java:149)
        at org.eclipse.jdt.internal.codeassist.SelectionEngine.selectFrom
(SelectionEngine.java:607)
        at org.eclipse.jdt.internal.codeassist.SelectionEngine.select
(SelectionEngine.java:520)
        at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:169)
        at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect
(CompilationUnit.java:269)
        at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect
(CompilationUnit.java:263)
        at 
org.eclipse.jdt.internal.ui.text.java.hover.AbstractJavaEditorTextHover.getHover
Info(AbstractJavaEditorTextHover.java:95)
        at 
org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo
(BestMatchHover.java:140)
        at 
org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInf
o(JavaEditorTextHoverProxy.java:69)
        at org.eclipse.jface.text.TextViewerHoverManager$2.run
(TextViewerHoverManager.java:119)
Comment 1 Jerome Lanneluc CLA 2003-12-15 07:36:04 EST
Rewrote HandleFactory. Added regression test 
ResolveTests.testMethodDeclarationInAnonymous3()
Comment 2 Frederic Fusier CLA 2003-12-17 07:05:02 EST
Verified for 3.0 M6 with build I200312162000