[cdi-dev] CDI-471 and repeatable annotations

Martin Kouba mkouba at redhat.com
Mon Nov 21 08:25:28 EST 2016

Dear EG,

during the review of CDI API 2.0.Alpha5 with modified Annotated SPI [1] 
I came across few questionable parts:

1. We should be more clear that the original methods like 
Annotated.getAnnotations() or Annotated.isAnnotationPresent() DO NOT 
support repeatable annotations - this is what Reflection API does to 
remain backward compatible - see also AnnotatedElement javadoc [2]
2. Thus AnnotatedElement.getAnnotation(Class<T>) should not be 
deprecated - for the same reasons as 
AnnotatedElement.getAnnotation(Class<T>) is not
3. We should provide a default implementation of 
Annotated.getAnnotations(Class<T>), otherwise a lot of extensions 
providing their own Annotated implementations would be broken
4. We should consider renaming the method to "getAnnotationsByType()" to 
keep it simple for users used to Reflection API





More information about the cdi-dev mailing list