RFR: 8004912: Repeating annotations - getAnnotationsByType is not working as expected

Andreas Lundblad andreas.lundblad at oracle.com
Wed Oct 23 15:36:53 UTC 2013


On 10/22/2013 03:20 PM, Peter Levart wrote:
> I think the problem could be solved in two ways:
>
> - by explicitly scanning the inheritance chain for the 1st class that 
> has the annotations of type T present directly or indirectly (by 
> containment).
>
> - by "canonicalizing" the representation of the repeating annotations 
> in the class file attributes. By this I mean that each repeating 
> annotation is placed inside it's container at compile-time even if it 
> is a single annotation of a particular type. This would mean that some 
> features like specifying different @Targets or @Retentions for 
> repeating annotation types and their containers would be prohibited 
> and the specification would have to be changed. But I think this way 
> the "inheritance" aspect of repeating annotations would be consistent 
> even if not "looking through" containers (by using the old JDK7 API)...
>
> The "canonicalization" could be performed at runtime though, and I 
> think there were such attempts already in the past. What happened to them?
>
>
> Regards, Peter
>

Hi Peter,

A new patch is available for review here:

http://cr.openjdk.java.net/~alundblad/inherited-associated/

This includes a new test based on your code. The test passes after 
applying the patch.

best regards,
Andreas Lundblad



More information about the core-libs-dev mailing list