Community
Participate
Working Groups
ITypeBinding#getDeclaringClass() currently returns null for capture type bindings. It should return the declaring type. For our TTypes, we need to be able to distinguish capture bindings from different projects even if they have the same key (rare case, I agree, but it could happen). Therefore, we have to store the project in which the capture binding is declared. We want to do this via getDeclaringClass().getJavaElement().getJavaProject(). Could this be implemented for the next I-build?
The spec of ITypeBinding#getDeclaringClass() would need to be changed as follow: /** * Returns the type binding representing the class, interface, or enum * that declares this binding. * <p> * The declaring class of a member class, interface, enum, annotation * type is the class, interface, or enum type of which it is a member. * The declaring class of a local class or interface (including anonymous * classes) is the innermost class or interface containing the expression * or statement in which this type is declared. * </p> * <p>The declaring class of a type variable is the class in which the type * variable is declared if it is declared on a type. It returns * <code>null</code> otherwise. * </p> * <p>The declaring class of a capture binding is the innermost class or * interface containing the expression or statement in which this capture is * declared. * </p> * <p>Array types, primitive types, the null type, top-level types, * wildcard types have no declaring class. * </p> * * @return the binding of the type that declares this type, or * <code>null</code> if none */ Jeem can you please review this change ?
Jerome, Spec looks good.
Thanks Jeem. Released modified spec and corresponding implementation in TypeBinding#getDeclaringClass(). Added test ASTConvert15Test#test0177().
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.