Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 478661

Summary: JavaElementDelta does not have annotations info when parameter annotations are modified
Product: [Eclipse Project] JDT Reporter: Kim Tsao <ktsao>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jarthana
Version: 4.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Kim Tsao CLA 2015-09-29 14:10:23 EDT
In out adopter product, we have a class that listens to JDT events to determine what annotations have been added or removed.  This works fine in all cases except for parameter scoped annotations. 

For method scoped annotations, the IJavaElementDelta object gives me enough information to determine what annotation has changed but that's not the case for parameter scoped annotations:

Method scoped:
[Working copy] Test.java[*]: {CHILDREN | FINE GRAINED | AST AFFECTED}
	Test[*]: {CHILDREN | FINE GRAINED}
		method(String)[*]: {ANNOTATIONS}
			@XYZ[+]: {}


Parameter scoped:
[Working copy] Test.java[*]: {CONTENT | FINE GRAINED | AST AFFECTED}


To reproduce, you can create a java class and add/delete a parameter scoped annotation on a method (I created a custom annotation called @XYZ in this example).  Set a breakpoint on the constructor of the org.eclipse.jdt.core.ElementChangedEvent class and inspect the IJavaElementDelta object.


public class Test {

	public void method(@XYZ String param){
		
	}
}
Comment 1 Jay Arthanareeswaran CLA 2015-09-30 02:49:29 EDT
This has not been done so far. While I am not sure if this was a conscious decision, since this relates to the method header this might be a good addition.

No promise yet, though.
Comment 2 Jay Arthanareeswaran CLA 2015-09-30 03:01:38 EDT
Actually on another look, there may be problems. The IJavaElementDelta#F_ANNOTATIONS states that this is specific to the annotations on the element. And that getAnnotationDeltas() will return the changed annotations on the element. The annotations on the parameter don't belong to the method but to the parameter and we don't yet report changes to the parameter. And it will be simply wrong to attach the delta of an argument to the method.
Comment 3 Eclipse Genie CLA 2019-10-23 01:52:01 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.