Community
Participate
Working Groups
Using RC2 + JDT/Core HEAD, I found two cases where the positions are wrong: 1) public class Y { public static void foo(Object object) { /** * javadoc comment. */ if (object instanceof ClassLoader) { final String clr = null; } } } the start position of the variable declaration statement is the start of the javadoc comment. 2) public class X { public final void foo(boolean[]value) { } } the position of the 'boolean' includes the whole single variable declaration. If boolean is replaced with int, it works fine. These are problems that can potentially lead to refactoring issues.
I have a fix for the second problem. I am investigating the first one.
+1 for RC3 if simple fixes. Dirk - do you want better DOM AST positions ?
First problem does not seem to have side effect on refactoring. I can rename "clr" without any trouble...
Let's focus first on the second issue. I opened bug 100041 for the first issue.
Created attachment 23086 [details] Proposed fix This is fixing the problem. boolean was missing in the list of possible tokens.
Created attachment 23087 [details] Corresponding regression test
Frederic, rename isn't affected since it relies on positions reported from search. However, rename local in files should be. +1 for RC3 since incorrect positions can really hurt refactoring & quick fix.
Fixed and released in HEAD. Regression test added in org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2.test0612
Verified using N20050616-0010 + JDT/Core HEAD
*** Bug 103315 has been marked as a duplicate of this bug. ***