Bug 93275 - Need ITypeBinding#getDeclaringClass() for capture types
Summary: Need ITypeBinding#getDeclaringClass() for capture types
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-29 11:21 EDT by Markus Keller CLA
Modified: 2005-05-12 09:51 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-04-29 11:21:31 EDT
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?
Comment 1 Jerome Lanneluc CLA 2005-04-29 12:57:10 EDT
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 ?
Comment 2 Jim des Rivieres CLA 2005-04-29 14:16:45 EDT
Jerome, Spec looks good.
Comment 3 Jerome Lanneluc CLA 2005-05-02 04:47:35 EDT
Thanks Jeem. Released modified spec and corresponding implementation in
TypeBinding#getDeclaringClass(). Added test ASTConvert15Test#test0177().
Comment 4 Frederic Fusier CLA 2005-05-12 09:51:42 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.