Summary: | [DOM] Class initializers' local variables' IVariableBinding have no declaring class | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | arlindolima |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED INVALID | QA Contact: | |
Severity: | major | ||
Priority: | P3 | CC: | jarthana, markus.kell.r, Olivier_Thomann |
Version: | 3.7 | ||
Target Milestone: | 3.7 M5 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Whiteboard: |
Description
arlindolima
2011-01-11 07:24:19 EST
It would be an API breakage to return a declaring class for a local variable. /** * Returns the type binding representing the class or interface * that declares this field. * <p> * The declaring class of a field is the class or interface of which it is * a member. Local variables have no declaring class. The field length of an * array type has no declaring class. * </p> * * @return the binding of the class or interface that declares this field, * or <code>null</code> if none */ public ITypeBinding getDeclaringClass(); Closing as INVALID. You can retrieve the declaring method for the local variable. If you get null for the declaring method and null for the declaring class, then you know that you have a local variable inside an initializer (static or not). It would be very useful to know the declaring class (for building a "semi-qualified" name - I know local variables have no qualified name). But not a bug, indeed. Should this be considered as a RFE? (In reply to comment #2) > It would be very useful to know the declaring class (for building a > "semi-qualified" name - I know local variables have no qualified name). But not > a bug, indeed. Should this be considered as a RFE? Yes, please. Open a new bug report. A new method would be required on IVariableBinding. In your case would the binding's key be good enough ? Yes, I'm currently using the binding key. But knowing the enclosing class matters would be a very desirable feature. Verified for 3.7M5 |