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

Jozef Hartinger jharting at redhat.com
Thu Aug 27 03:17:16 EDT 2015


Agreed, this looks like a bug in Weld.

On 26.08.2015 16:56, arjan tijms wrote:
> 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.
>


More information about the cdi-dev mailing list