You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Raymond Augé (Jira)" <ji...@apache.org> on 2021/09/15 19:22:00 UTC

[jira] [Created] (ARIES-2059) ensure that repeatable annotations are processed in definition order

Raymond Augé created ARIES-2059:
-----------------------------------

             Summary: ensure that repeatable annotations are processed in definition order
                 Key: ARIES-2059
                 URL: https://issues.apache.org/jira/browse/ARIES-2059
             Project: Aries
          Issue Type: Bug
          Components: CDI
            Reporter: Raymond Augé
            Assignee: Raymond Augé
             Fix For: cdi-1.1.4


When a repeatable annotation is defined on a class, the API {{javax.enterprise.inject.spi.Annotated}} can be misleading because {{<T extends Annotation> Set<T> getAnnotations(Class<T> annotationType);}} returns a Set.

This means that implementations are free to return annotations not in definition order.

Aries CDI mistakenly used this API to retrieve {{@PID}} annotations (which are repeatable.)

The work around is pretty simple, when needing to retrieve repeatable annotations in definition order pass the container annotationType (all repeatable annotations have a container annotation type) to the method instead, in this case {{getAnnotations(PIDs.class)}} and then get the {{@PIDs.value()}} array which contains the {{@PID}} annotations in definition order.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)