Community
Participate
Working Groups
I20090917-0100 Investigating a fix for bug 223315, I was trying to reconcile a compilation unit using a call to: unit.reconcile(AST.JLS3, true, true, unit.getOwner(), null); and noticed that I was not getting any bindings in the AST. Talking with Olivier, he felt that we should probably be getting back an AST with bindings.
The compilation unit in question was for the sample snippet given in bug 223315 comment # 3
Looks like the point of the matter is whether the WorkingCopyOwner overrides getProblemRequestor(..). I only ever see bindings when the WorkingCopyOwner actually returns an IProblemRequestor. When the returned IProblemRequestor is null or its isActive() method returns false, I don't get bindings. Although the Javadoc of the reconcile(..) methods says "Its bindings are computed only if the problem requestor is active, or if the problem detection is forced", it looks like it actually implements "*and* if the problem detection is forced" (maybe also if problem detection is not forced but the working copy is not consistent -- I didn't check that). I made my observations by tweaking ASTView#createAST(ITypeRoot, int, int) from jdt-ui-home/plugins/org.eclipse.jdt.astview .
This is exactly what we noticed yesterday and I believe this is inconsistent. Would it be a problem for you to fix this or you have code that relies on this behavior ?
> Would it be a problem for you to fix this or you have code that relies on this > behavior ? You mean you want to completely implement the Javadoc, i.e. return bindings also with an inactive or inexistent problem requestor if problem detection is being forced? I don't think we expect anywhere to get no bindings there, so that fix would be fine with me (it won't affect us).
Right, the behavior will not be affected but it can have a performance hit as this will result in more work in certain scenarios. At this point please don't touch this and simply update the Javadoc, especially since it's not really needed that we fix this now. Also note that the fix would not even fix any client issue if the owner is the default one as the editor reconciler only activates the problem requestor when he's running.
That's fine for me. Much simpler to fix :-).
Created attachment 147915 [details] Proposed fix
Bindings are only created if the problem reporter is active. I removed the mention to ", or if the problem detection is forced" for all reconcile methods as this clearly doesn't match the current implementation. Changing that might have a bad side-effect for existing clients in term of performance. Released for 3.6M3.
Verified for 3.6M3