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

arjan tijms arjan.tijms at gmail.com
Wed Aug 26 10:56:15 EDT 2015


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:


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

More information about the cdi-dev mailing list