Community
Participate
Working Groups
Using I200405140800 build. I was testing DOM AST nodes hierarchy building on all eclipse source files and noticed a problem in class org.eclipse.update.internal.model.InstallConfigurationParser Here's a smaller example easier to debug: import java.util.Vector; public class A { AA aa; void foo() { int size = (aa.bar()).size(); System.out.println("Size=" + size); } } class AA { Vector bar() { return new Vector(1); }; } In this case, (aa.bar()).size() ExpressionStatement has the same start position and length than aa.bar() which is not correct. Here's a more annoying variation of this problem: import java.util.Vector; public class A { AA aa; void foo() { (aa.bar()).get(0); // comment if (true) { System.out.println("Hello: " + toString()); //$NON-NLS-1$ } } } class AA { Vector bar() { return new Vector(1); }; } In this case (aa.bar()).get(0) ExpressionStatement starts at 'aa' and ends at semi-colon of syso statement! I used ASTView plugin to see the invalid node ranges. Looking at code, it seems that enclosing parenthesis around aa.bar() expression statement are not correctly handled in removeTrailingCommentFromExpressionEndingWithAParen(ASTNode) and retrieveEndingSemiColonPosition(int,int) methods of ASTConverter...
I am investigating.
Fixed and released in HEAD. The code to optimize the case of cascading method invocations was not handling intermediate parenthesized expressions. Regression tests added (ASTConverterTest2.test0556 and test0557).
Verified for 3.0M9