Community
Participate
Working Groups
I20060301-0800 Create an AST from an IClassFile with source attachment, e.g. java.lang.Integer -> was: the ITypeBinding for Integer answers true for isFromSource() -> expected: false On the other hand, when I create an AST for a compilation unit that refers to Integer and resolve a type binding for Integer there, the binding is not a source binding (as expected). Comparing these two different kinds of type bindings with isEqualsTo(..) returns false, although their keys are equal.
I think I can work around this for the moment by comparing keys instead of using isEqualTo(..). However, I'm not sure whether I've found all references, and I would appreciate if this could be handled with priority.
The spec says: Returns whether this type binding originated in source code. In this case, the binding comes from source code (the attached source) and not from the .class file. If you create an AST for a compilation unit that refers to Integer and resolve a type binding for Integer, then the attached source is not used, and the binding is from the .class file.
OK, it's not how I understood ITypeBinding#isFromSource(), but I can accept your interpretation, although I think it's very implementation-specific and not client-oriented. Clients are typically only intersted in whether the declaring type is from a class file or from a (potentially modifiable) .java file. Still, isEqualTo(..) is spec'd to return true if the keys of the two bindings are the same. Adapting summary.
Fixed BindingComparator#isEqual(TypeBinding,TypeBinding,HashSet) to filter out the AccSuper bit from the binary binding modifier. Added regression test ASTConverterTestAST3_2#test0641().
Verified for 3.2M6 using build I20060327-0010.