Bug 99982 - [DOM] Wrong positions for boolean[] type
Summary: [DOM] Wrong positions for boolean[] type
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 103315 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-14 11:34 EDT by Olivier Thomann CLA
Modified: 2005-07-11 12:06 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (703 bytes, patch)
2005-06-14 14:37 EDT, Olivier Thomann CLA
no flags Details | Diff
Corresponding regression test (2.82 KB, patch)
2005-06-14 14:38 EDT, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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. ***