Bug 99982

Summary: [DOM] Wrong positions for boolean[] type
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: dirk_baeumer, overcurious
Version: 3.1   
Target Milestone: 3.1 RC3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix
none
Corresponding regression test none

Description Olivier Thomann CLA 2005-06-14 11:34:09 EDT
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.
Comment 1 Olivier Thomann CLA 2005-06-14 11:47:58 EDT
I have a fix for the second problem. I am investigating the first one.
Comment 2 Philipe Mulet CLA 2005-06-14 12:15:19 EDT
+1 for RC3 if simple fixes.

Dirk - do you want better DOM AST positions ?
Comment 3 Frederic Fusier CLA 2005-06-14 13:09:11 EDT
First problem does not seem to have side effect on refactoring.
I can rename "clr" without any trouble...
Comment 4 Olivier Thomann CLA 2005-06-14 14:28:52 EDT
Let's focus first on the second issue.
I opened bug 100041 for the first issue.
Comment 5 Olivier Thomann CLA 2005-06-14 14:37:49 EDT
Created attachment 23086 [details]
Proposed fix

This is fixing the problem. boolean was missing in the list of possible tokens.
Comment 6 Olivier Thomann CLA 2005-06-14 14:38:20 EDT
Created attachment 23087 [details]
Corresponding regression test
Comment 7 Dirk Baeumer CLA 2005-06-14 16:51:10 EDT
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.
Comment 8 Olivier Thomann CLA 2005-06-14 20:59:00 EDT
Fixed and released in HEAD.
Regression test added in
org.eclipse.jdt.core.tests.dom.ASTConverterTestAST3_2.test0612
Comment 9 Olivier Thomann CLA 2005-06-16 14:54:19 EDT
Verified using N20050616-0010 + JDT/Core HEAD
Comment 10 Olivier Thomann CLA 2005-07-11 12:06:56 EDT
*** Bug 103315 has been marked as a duplicate of this bug. ***