Community
Participate
Working Groups
build I20070917-0010 1) create X.java public class X { void foo() { int a /*a*/, b /*b*/; for (int i /*i*/, j /*j*/;;) { } } } 2) build a DOM AST (with ASTView). The end of 'a' is after '/*a*/'. The end of 'b' is after '/*a*/'. The end of 'i' is after 'int i' and not after '/*i*/'. The end of 'j' is after ', j' and not after '/*j*/'. The end of the fragment should be the same in each case.
Do we want to include the trailing comment inside the positions ? I would say no. The comment could be included in the extended range though. David, any thought ?
My explanation wasn't clear. The problem isn't related to trailing comments. The problem is the same without comments. public class X { void foo() { int a , b ; for (int i , j ;;) { } } } Inside a 'for' statement the end of the fragment is at the end of the variable name and inside a locale variable the end is just before the next comma or semicolon. The problem is in the same area as bug 199668.
The positions should be consistent in both cases. No whitespaces should be included in the position range.
Created attachment 78775 [details] Proposed fix
Created attachment 78776 [details] Regression test
Created attachment 78882 [details] New fix
Released in HEAD. Regression test added in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2#test0686
Verified for 3.4M3 using I20071029-0800