Bug 40954 - ArrayIndexOutOfBoundsException during sort members
Summary: ArrayIndexOutOfBoundsException during sort members
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-30 12:55 EDT by Olivier Thomann CLA
Modified: 2003-08-28 05:35 EDT (History)
0 users

See Also:


Attachments
Test case (22.50 KB, text/plain)
2003-07-30 12:56 EDT, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2003-07-30 12:55:46 EDT
Using latest, I got an ArrayIndexOutOfBoundsException trying to sort members on
the attached test case.
Comment 1 Olivier Thomann CLA 2003-07-30 12:56:57 EDT
Created attachment 5586 [details]
Test case

Run sort member on this test case renaming it as  a compilation unit
Comment 2 Olivier Thomann CLA 2003-07-30 13:07:16 EDT
Change milestone.
Comment 3 Olivier Thomann CLA 2003-07-30 14:24:17 EDT
The modifiers needs to be reset when parsing a anonymous class declaration.
Small test case:
package p;
public class X {
	X bar() {
		// comment
		return new X() {
			void bar6() {}
			void bar4() {}
			void bar5() {}
		};
	}
}
The declaration source start for bar6() was the beginning of the comment because
the modifier source start has not been reset.
I added a reset of modifiers when the 'new' keyword is processed. It needs to be
done before the creation of method declarations inside the anonymous class.
Fixed and released in HEAD.
Regression test added.
Comment 4 David Audel CLA 2003-08-28 05:35:38 EDT
Verified.