Getting synthetic methods from an ITypeBinding

213 views Asked by At

I'm playing with the ITypeBinding that I get when calling resolveBinding() on an ASTNode in the AST made by ASTParser and a K_COMPILATION_UNIT from a Java Project.

For example I have resolved an ITypeBinding for java.lang.String, but the synthetic methods are missing (compareTo(Object) in this case). The documentation for ITypeBinding states that the synthetic methods may or may not be there, but the isSynthetic method suggests there should be some way of convincing the ITypeBinding to include synthetic methods as well.

If I get an IType by calling ITypeBinding.getJavaElement() it contains the synthetic methods I'm looking for, but it would be easier if I could get them from the ITypeBinding directly.

Any ideas?

1

There are 1 answers

0
Jacek Sieka On BEST ANSWER

I found my answer by looking at the implementation which explicitly skips synthetic methods - first by skipping them when recovering methods from the compiler AST and then by always returning false from the implementation of isSynthetic method - this is so for Eclipse 3.7.