Bug 59848 - ITypeBinding.isAnonymous() never work
Summary: ITypeBinding.isAnonymous() never work
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-23 16:52 EDT by Kelvin CLA
Modified: 2004-05-11 10:30 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 Kelvin CLA 2004-04-23 16:52:22 EDT
I tries many ways but the isAnonymous() always return false. Is it suppose to
return true in this situation

MyInterface myi = new MyInterface() {// ITypeBinding.isAnonymous() return true?

};

myi.toString();  // ITypeBinding.isAnonymous() return true??
Comment 1 Olivier Thomann CLA 2004-04-26 15:30:01 EDT
I checked only in the 3.0 stream.
In MyInterface myi = new MyInterface() {// ITypeBinding.isAnonymous() return true?
};

The ITypebinding for the anonymous type declaration (retrieved using
classInstanceCreation.getAnonymousTypeDeclaration().resolveBinding() does return
true to isAnonymous().
On what binding did you try isAnonymous()? If it is on the binding of the
variable declaration fragment. It won't return true to isAnonymous() because its
type is MyInterface.
The type binding for myi in myi.toString(); doesn't return true to
isAnonymous(). Its type is MyInterface.

The isAnonymous() only answers true for the type binding of an anonymous type
declaration or its corresponding class instance creation.
So isAnonymous() returns true for the type binding of
- the class instance creation that corresponds to new MyInterface() {//
ITypeBinding.isAnonymous() return true?

}
- the anonymous type declaration of the class instance creation that corresponds
to new MyInterface() {// ITypeBinding.isAnonymous() return true?

}.

Does this clarify it?
Comment 2 Olivier Thomann CLA 2004-04-26 15:39:58 EDT
Add CC'
Comment 3 Olivier Thomann CLA 2004-05-10 09:29:16 EDT
Did my comment help you to understand when it is working?
Comment 4 Olivier Thomann CLA 2004-05-11 10:30:08 EDT
Closing.