Summary: | Inner Annotation Checks are Missing | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Mahmood Ali <msaeed999> | ||||||
Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P3 | CC: | kent_johnson, Olivier_Thomann, satyam.kandula | ||||||
Version: | 3.6 | Flags: | kent_johnson:
review+
|
||||||
Target Milestone: | 3.6 M2 | ||||||||
Hardware: | All | ||||||||
OS: | Mac OS X - Carbon (unsup.) | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Mahmood Ali
2009-08-19 01:03:13 EDT
Ayushman, please investigate. The problem is in ReferenceBinding$detectAnnotationCycle . In the non generic class case, the signature of method value is 'Test.Anno value()', while in the generic case, signature is simply 'Anno value'. So in the latter case the comparison of return type of method value with the member type Anno fails. Hence no cycle is reported. Fixing the problem results in the following error for the generic class case. Cycle detected: a cycle exists between annotation attributes of Test<T>.Anno and Test.Anno whereas it should actually be Cycle detected: the annotation Anno cannot contain attributes of the annotation type itself (i think this happens because of type erasure.I'm not sure though.) Also, I'm not sure whether the signature for the generic case is correct. Shouldn't it also be Test.Anno value()? Kent, what do you think? > Also, I'm not sure whether the signature for the generic case is correct.
> Shouldn't it also be Test.Anno value()?
Do you mean in the error message ? If so, then no it should be "Test<T>.Anno"
I got the 'correct' error message with a simple change :
Cycle detected: the annotation Test<T>.Anno cannot contain attributes of the annotation type itself
Hint : the return type needs to be converted.
Created attachment 145638 [details]
Proposed fix + regression test
Thanx Kent. So basically the problem was indeed due to type erasure.
I would have done this instead : TypeBinding returnType = currentMethods[i].returnType.leafComponentType().erasure(); We do not need the parameterized return type so just convert it. Ayushman, please provide a new patch based on Kent's comment. Once this is done, Kent, please review and release. Created attachment 145767 [details]
Modified patch + regression test
Released to HEAD for 3.6M2 Verified for 3.6M2 using I20090914-1800 build Verified. |