Bug 209823 - IAnnotation#getSourceRange() and #getNameRange() throw JME on annotation of ILocalVariable
Summary: IAnnotation#getSourceRange() and #getNameRange() throw JME on annotation of I...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-14 10:38 EST by Markus Keller CLA
Modified: 2007-12-12 03:49 EST (History)
1 user (show)

See Also:


Attachments
Proposed fix and regression test (4.83 KB, patch)
2007-11-16 03:36 EST, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-11-14 10:38:16 EST
HEAD (follow-up to bug 209661)

IAnnotation#getSourceRange() and #getNameRange() throw a JavaModelException on the annotation of an ILocalVariable:
JavaModelException: @SuppressWarnings [in arg [in m(int) [in Try [in [Working copy] Try.java [in xy [in src [in zz1.5]]]]]]] does not exist

Steps:
- have:
package xy;
@SuppressWarnings("unused") // OK
class Try {
	void m(@SuppressWarnings("unused") int arg) { // throws JME
		@SuppressWarnings("unused") int local; // throws JME
	}
}

- show one of the ILocalVariables in the JavaElements View (see bug 209661 for steps)
- expand ANNOTATIONS (1)
- select the annotation
- open the Properties view (e.g. via context menu)

It could be that the get*Range() methods work when invoked for the first time but fail on subsequent invocations (at least that's what I saw in the debugger).
Comment 1 Jerome Lanneluc CLA 2007-11-16 03:36:17 EST
Created attachment 83047 [details]
Proposed fix and regression test
Comment 2 Jerome Lanneluc CLA 2007-11-16 05:07:02 EST
Fix and tests released for 3.4M4
Comment 3 Maxime Daniel CLA 2007-12-12 03:49:55 EST
Verified for 3.4 M4 using build I20071211-0010 (watching the tests fail in JME with I20071101-2000 and succeed with I20071211-0010).