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

John D. Ament john.d.ament at gmail.com
Thu Aug 27 06:58:35 EDT 2015


I'd be concerned if we introduced text explicitly calling out code written
by the developer instead of generated by the compiler.  What if I'm using
an annotation processor that generated implementations for CDI beans? Those
would get ignored.

Better to say something along the lines of synthesized methods are not
typically visible, therefore shouldn't be scanned.

John

On Wed, Aug 26, 2015 at 12:14 PM Antoine Sabot-Durand <
antoine at sabot-durand.net> wrote:

> 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.
>>
> _______________________________________________
> 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/20150827/068b5b6e/attachment.html 


More information about the cdi-dev mailing list