Bug 209661 - ILocalVariable for method parameter misses annotations
Summary: ILocalVariable for method parameter misses annotations
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: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-13 11:37 EST by Markus Keller CLA
Modified: 2007-12-11 07:44 EST (History)
2 users (show)

See Also:


Attachments
Regression test (1.26 KB, patch)
2007-11-14 09:41 EST, Jerome Lanneluc CLA
no flags Details | Diff
Propose fix (4.87 KB, patch)
2007-11-15 04:44 EST, David Audel 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-13 11:37:01 EST
HEAD

The the method parameter 'arg' misses its annotations in the model (ILocalVariable#getAnnotations() is empty):

	void m(@SuppressWarnings("unused") int arg) { // annotations missing
		@SuppressWarnings("unused") int local; // annotations OK
	}
Comment 1 Jerome Lanneluc CLA 2007-11-14 09:41:20 EST
Created attachment 82875 [details]
Regression test
Comment 2 Jerome Lanneluc CLA 2007-11-14 09:44:14 EST
I assume that the ILocalVariable is obtained through a codeSelect(...).
In this case it looks like a recovery problem. The SelectionOnLocalName node doesn't contain the annotation in the case of an argument.

David can you please investigate?
Comment 3 Markus Keller CLA 2007-11-14 10:39:00 EST
> I assume that the ILocalVariable is obtained through a codeSelect(...).
Yes, via the first toolbar button in the JavaElements View.

If I open the IVariableBinding for the parameter in the ASTView, select the LocalVariable Java element (the last child of the binding), and then choose Navigate > Show In > JavaElement View, then the resulting input element has an IAnnotation.
Comment 4 David Audel CLA 2007-11-15 04:44:17 EST
Created attachment 82951 [details]
Propose fix

Annotations wasn't attached to the selection node inside SelectionParser#consumeFormalParameter()
Comment 5 David Audel CLA 2007-11-15 04:47:13 EST
Released for 3.4M4.

Tests added
  ResolveTests_1_5#test0111() -> test0112()
  CompilationUnitTests#testAnnotations24()
Comment 6 Eric Jodet CLA 2007-12-11 07:44:47 EST
Verified (using the JavaElement View) for 3.4 M4 using build I20071210-1800