Community
Participate
Working Groups
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??
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?
Add CC'
Did my comment help you to understand when it is working?
Closing.