[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.jdt] Re: IMethodBinding#overrides() returns false when true is expected

Hi Olivier,

Thanks for the clarification. I thought so myself but since there is nothing like that mentioned in the java doc I hoped it would work nontheless.

I actually have tried the method you propose, but run into several problems.
Hopefully you can aid me a little bit further?

First of all, it is documented, that only batches of units from the same project can be processed. I am working on a rather large application and it is likely to happen, that an implementing class is placed in another project as the abstract superclass is.

Do I have to conclude, that I have no possibility to use the bindings to check if a method overrides another one in such cases since I cannot create the ASTs in a batch?

And second I am not sure what to input as second parameter.
Do I have to insert every binding key I want to have resolved?

Because I simply want all bindings to be resolved.
When running this method with an empty String[] I later got a null result from a methodDeclaration.resolveBinding() invokation, so I assume that several bindings were not resolved during the AST creation. When Creating the ASTs with multiple parser runs, these bindings are all present (but not compatible regarding the override() method ;o(( ).


Could you tell me, what i have to input there?


Thank you so far and best regards Sebastian

Olivier Thomann schrieb:
Sebastian Schmidt a écrit :
there is a comparison of two SourceTypeBinding instances "if (currentType == otherType)" that results to false even if the two instances represent the same type (AbstractExample). They have different ids in the Variables view but the same value (at least the string representation in the value view is identical). Sadly even the .equals method returns false.
You cannot compare bindings that comes from two different ast parser runs.
You can create the bindings you want on demand using the method org.eclipse.jdt.core.dom.ASTParser.createASTs(ICompilationUnit[], String[], ASTRequestor, IProgressMonitor).


HTH,

Olivier