Community
Participate
Working Groups
After bug 399792 is released, AST rewrite support should be added to casts with intersection types.
Created attachment 230058 [details] Proposed fix Patch with changes to ASTRewriteAnalyzer and new test. The patch also include a fix to DefaultASTVisitor. Markus, this is a straight forward fix. Could you glance over the patch, please? Note: The new test is disabled as this is also affected by the formatter bug 401848.
(In reply to comment #1) > Note: The new test is disabled as this is also affected by the formatter bug > 401848. I meant to say, the test is currently failing and has to be disabled if bug 401848 is still open at the time of releasing.
I've already fixed the ASTRewriteAnalyzer with bug 399792 comment 15. That fix inserted the visit(IntersectionType) method at the right position. I copied my implementation from the structurally equivalent visit(UnionType). However, your implementation that unconditionally calls rewriteNodeList(..) is better, since rewriteNodeList already calls doVisit if there's no change. We should also remove the same redundant condition check from visit(UnionType), visit(TypeParameter), rewriteExtraDimensionsInfo(..), visit(ExtraDimension), and visit(MethodDeclaration). Basically everywhere where "if (isChanged(" is called and we don't have to scan for a start position. I think we should not disable the test, but adapt the expected result to the current reality and add a link to the pending formatter bug. It's easy to fix a few failing tests when the formatter fix is ready. But if you disable the test, then we don't have any regression test at all.
Released the fix with changed suggested by Markus via commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=51c6ca3e4dfed3078a1640da7a2ab7f26c899e0a