Bug 10592 - ast: NPE in SingleVariableDeclaration::resolveBinding
Summary: ast: NPE in SingleVariableDeclaration::resolveBinding
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-01 11:40 EST by Adam Kiezun CLA
Modified: 2002-03-01 15:11 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 Adam Kiezun CLA 2002-03-01 11:40:23 EST
package p;
class A{
	native void m(int i);
}

i get an NPE when i call resolveBinding on the declaration of 'i'
(the CompilationUnit node was created with resolveBindings == true, 
if that makes a difference)

java.lang.NullPointerException
	at org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveVariable
(DefaultBindingResolver.java:297)
	at org.eclipse.jdt.core.dom.VariableDeclaration.resolveBinding
(VariableDeclaration.java:92)
Comment 1 Olivier Thomann CLA 2002-03-01 11:42:56 EST
In this case, I guess you expect null to be returned.
Comment 2 Adam Kiezun CLA 2002-03-01 11:45:48 EST
when creating regression tests for it - please include also this one:
abstract class A{
	abstract void m(int i);
}
Comment 3 Adam Kiezun CLA 2002-03-01 12:01:02 EST
this one is meybe related 
(resolveBinding on the SimpleName 'k' inside the qualified name 'j.k'):

class A{
	int k;
	static class j{
		static int k;
	}
	void m(){
		int y= 0;
		j.k= 0;
	}
}	

stack trace is different:
at org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveNameForNameReference
(DefaultBindingResolver.java:222) 
at  org.eclipse.jdt.core.dom.DefaultBindingResolver.resolveName
(DefaultBindingResolver.java:97)
at org.eclipse.jdt.core.dom.Name.resolveBinding(Name.java:75)
Comment 4 Adam Kiezun CLA 2002-03-01 12:02:35 EST
another test case for your collection :)

(resolveBinding on the declaration of 'i')
interface A{
	 void m(int i, int j);
}
Comment 5 Olivier Thomann CLA 2002-03-01 15:11:00 EST
I forgot to connect the name inside a SingleVariableDeclaration. So it was 
impossible to retrieve the compiler node corresponding to a method parameter.
Fixed and released in HEAD.
Comment 6 Olivier Thomann CLA 2002-03-01 15:11:51 EST
Fixed.