[cdi-dev] Problem with JDK8 u60 and synthesized methods for lambdas now exposing annotations

Antoine Sabot-Durand antoine at sabot-durand.net
Wed Aug 26 12:13:15 EDT 2015


Hi Arjan,

I'm not sure that we should state that in the spec. The fact that the
compiler generates a synthetic method for the lambda is a java
implementation choice. Our implementation should only consider code written
by user not the one generated by the compiler. Wdyt Jozef ?

Antoine

Le mer. 26 août 2015 à 16:56, arjan tijms <arjan.tijms at gmail.com> a écrit :

> Hi,
>
> We just discovered an issue where using a lambda in an observer method
> results in a synthesized method for that lambda that since u60 makes
> the @Observes annotation visible. This will cause CDI (Weld
> 2.2.2.Final in this case as shipped with GlassFish 4.1) to see this
> generated method as an actual observer method.
>
> See the following mail on the OpenJDK list for details:
>
>
> http://mail.openjdk.java.net/pipermail/lambda-dev/2015-August/012146.html/012146.html
>
> The suggestion there is that it's simply a bug in the CDI implementation.
>
> I wonder, should the CDI spec in general say that synthesized methods
> should be ignored when scanning for observer (and possible other)
> methods? I briefly scanned through the spec but didn't see any
> references to synthesized methods.
>
> Kind regards,
> Arjan Tijms
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20150826/6e6dad87/attachment-0001.html 


More information about the cdi-dev mailing list