[cdi-dev] CDI-471 and repeatable annotations

John Ament john.ament at spartasystems.com
Mon Nov 21 08:47:00 EST 2016


Martin,


I'll make these changes for #1-#3.  I'm not in favor of #4.  Its not consistent with our existing method.  (I'd prefer consistency of our API over consistency with the Java lang's spec)


I may get to them this evening.


John


________________________________
From: cdi-dev-bounces at lists.jboss.org <cdi-dev-bounces at lists.jboss.org> on behalf of Martin Kouba <mkouba at redhat.com>
Sent: Monday, November 21, 2016 8:25 AM
To: cdi-dev
Subject: [cdi-dev] CDI-471 and repeatable annotations

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

Thanks,

Martin

[1]
https://github.com/cdi-spec/cdi/pull/330
[https://avatars3.githubusercontent.com/u/108167?v=3&s=400]<https://github.com/cdi-spec/cdi/pull/330>

CDI-471 Introduce SPI for retrieving multiple annotations of the same... by johnament · Pull Request #330 · cdi-spec/cdi<https://github.com/cdi-spec/cdi/pull/330>
github.com
... type, deprecating the old one. Updated spec docs for qualifiers to reflect repeatability and spec docs for annotated for new method.




[2]
https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/AnnotatedElement.html
AnnotatedElement (Java Platform SE 8 ) - Oracle<https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/AnnotatedElement.html>
docs.oracle.com
Represents an annotated element of the program currently running in this VM. This interface allows annotations to be read reflectively. All annotations returned by ...



_______________________________________________
cdi-dev mailing list
cdi-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev
cdi-dev Info Page - JBoss Developer<https://lists.jboss.org/mailman/listinfo/cdi-dev>
lists.jboss.org
List to discuss the development of CDI (the specification) To see the collection of prior postings to the list, visit the cdi-dev Archives.




Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
Apache License, Version 2.0<http://www.apache.org/licenses/LICENSE-2.0.html>
www.apache.org
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION. 1. Definitions.



________________________________
NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this message, and destroy all physical and electronic copies. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20161121/caa7ac22/attachment.html 


More information about the cdi-dev mailing list