Bug 10913 - DOM/AST: resolveBinding() for static field access
Summary: DOM/AST: resolveBinding() for static field access
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows NT
: P2 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-06 18:18 EST by Luc Bourlier CLA
Modified: 2002-03-07 11:31 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 Luc Bourlier CLA 2002-03-06 18:18:12 EST
version: 2002

2 problems when I use resolveBinding() on the generated AST for the following code :

public class Foo{
  int bar() throws Throwable {
    return Foo.x;
  }
  static int x;
}

the tree for "return Foo.x;" is :

ReturnStatement
 +-QualifiedName
    +-SimpleName: "Foo"
    +-SimpleName: "x"

1- resolveBinding() on SimpleName "Foo" returns a IVariableBinding object, I
expected a ITypeBinding

2- resolveBinding() on SimpleName "x" throws a NullPointerException :

java.lang.NullPointerException
 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 1 Olivier Thomann CLA 2002-03-07 11:31:00 EST
Already fixed in latest.
Closed.