<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">After some test I can answer myself. It’s bad because equals() is broken (2 annotations created with this code won’t be equals). And it works probably because all the equals call done in Weld are made from the inner Annotation not from user instance…</div><div class=""><br class=""></div><div class="">Also Annotation is not a functional interface.</div><div class=""><br class=""></div><div class="">Antoine</div><br class=""><div><blockquote type="cite" class=""><div class="">Le 15 sept. 2016 à 11:03, Martin Kouba &lt;<a href="mailto:mkouba@redhat.com" class="">mkouba@redhat.com</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Dne 15.9.2016 v 10:48 Antoine Sabot-Durand napsal(a):</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class=""><blockquote type="cite" class="">Le 15 sept. 2016 à 10:26, Martin Kouba &lt;<a href="mailto:mkouba@redhat.com" class="">mkouba@redhat.com</a>&gt; a écrit :<br class=""><br class="">Dne 15.9.2016 v 10:15 Antoine Sabot-Durand napsal(a):<br class=""><blockquote type="cite" class="">Just a naive remark regarding Instance of annotations without members. I already used a lambda to have such an instance:<br class=""><br class="">BeanManager.getBeans(MyBean.class, () -&gt; MyQualifier.class)<br class=""></blockquote><br class="">What is this cryptic unclear lambda thing doing actually? I know it compiles but I don't understand…<br class=""></blockquote><br class="">It compiles and works every the time I used it. From my understanding it’s a short cut for<br class=""><br class="">BeanManager.getBeans(MyBean.class, new Annotation() {<br class="">&nbsp;&nbsp;&nbsp;@Override<br class="">&nbsp;&nbsp;&nbsp;public Class&lt;? extends Annotation&gt; annotationType() {<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return MyQualifier.class;<br class="">&nbsp;&nbsp;&nbsp;}<br class="">})<br class=""><br class="">Which by the way also works. From your answer I guess it’s a bad solution ;), but I’d be happy to know why and what is the side effect makes it work.<br class=""></blockquote><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I don't say it's a bad solution, but it's not obvious and I consider similar things a bad practice, especially if we don't understand why it works ;-)</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class="">Thanks,<br class=""><br class="">Antoine<br class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class=""><br class="">I’m not sure there are no problem by using this short cut, but it is quite convenient.<br class=""><br class="">Antoine<br class=""><br class=""><br class=""><blockquote type="cite" class="">Le 12 sept. 2016 à 12:28, arjan tijms &lt;<a href="mailto:arjan.tijms@gmail.com" class="">arjan.tijms@gmail.com</a>&gt; a écrit :<br class=""><br class="">Hi,<br class=""><br class="">Wouldn't it be convenient as the CDI API that now requires an Annotation instance in various APIs, would also accept the class type of that Annotation?<br class=""><br class="">E.g. in BeanManager there's this method:<br class=""><br class="">Set&lt;Bean&lt;?&gt;&gt; getBeans(Type beanType, Annotation... qualifiers)<br class=""><br class="">This not rarely requires one to create an AnnotationLiteral, which is not specifically difficult but a tad verbose. For qualifiers that have no (binding) attributes, a simple Class would be much easier to use.<br class=""><br class="">Thoughts?<br class=""><br class="">Kind regards,<br class="">Arjan Tijms<br class="">_______________________________________________<br class="">cdi-dev mailing list<br class=""><a href="mailto:cdi-dev@lists.jboss.org" class="">cdi-dev@lists.jboss.org</a><br class="">https://lists.jboss.org/mailman/listinfo/cdi-dev<br class=""><br class="">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.<br class=""></blockquote><br class=""><br class="">_______________________________________________<br class="">cdi-dev mailing list<br class=""><a href="mailto:cdi-dev@lists.jboss.org" class="">cdi-dev@lists.jboss.org</a><br class="">https://lists.jboss.org/mailman/listinfo/cdi-dev<br class=""><br class="">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.<br class=""><br class=""></blockquote></blockquote><br class=""></blockquote><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">--<span class="Apple-converted-space">&nbsp;</span></span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Martin Kouba</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Software Engineer</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Red Hat, Czech Republic</span></div></blockquote></div><br class=""></body></html>