[arquillian-issues] [JBoss JIRA] (ARQ-2042) Bridge methods treated as observer methods in JDK8

Bartosz Majsak (JIRA) issues at jboss.org
Mon Sep 5 07:45:01 EDT 2016


     [ https://issues.jboss.org/browse/ARQ-2042?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bartosz Majsak updated ARQ-2042:
--------------------------------
    Description: 
The Java Compiler was changed with regards to synthetic methods and Annotations.

Before, annotations on parameters of the original generic methods were NOT copied on to the synthetic bridge method.

Now, the original annotation is present in 2 places: the generic method (with the actual type replaced in place of the type parameter) and the synthetic method.

When it comes to the @Observes annotation, Arquillian will try to call the synthetic method (which receives Object) with any kind of event, leading to a ClassCastException (because the bridge method does an implicit cast to the actual type and calls the real generic method)

The commit makes Arquillian ignore synthetic methods when searching for potential event listeners.

Discussion:
    http://discuss.arquillian.org/t/moving-from-persistence-impl-to-persistence-dbunit-with-openejb-embedded-4/294/7
    
See following bugs for details:
    
* http://bugs.java.com/view_bug.do?bug_id=6695379
* http://bugs.java.com/view_bug.do?bug_id=8072365


  was:
The Java Compiler was changed with regards to synthetic methods and Annotations.

Before, annotations on parameters of the original generic methods were NOT copied on to the synthetic bridge method.

Now, the original annotation is present in 2 places: the generic method (with the actual type replaced in place of the type parameter) and the synthetic method.

When it comes to the @Observes annotation, Arquillian will try to call the synthetic method (which receives Object) with any kind of event, leading to a ClassCastException (because the bridge method does an implicit cast to the actual type and calls the real generic method)

The commit makes Arquillian ignore synthetic methods when searching for potential event listeners.



> Bridge methods treated as observer methods in JDK8
> --------------------------------------------------
>
>                 Key: ARQ-2042
>                 URL: https://issues.jboss.org/browse/ARQ-2042
>             Project: Arquillian
>          Issue Type: Bug
>          Components: Base Implementation
>    Affects Versions: 1.1.11.Final
>         Environment: JDK 8
>            Reporter: Bartosz Majsak
>            Assignee: Bartosz Majsak
>
> The Java Compiler was changed with regards to synthetic methods and Annotations.
> Before, annotations on parameters of the original generic methods were NOT copied on to the synthetic bridge method.
> Now, the original annotation is present in 2 places: the generic method (with the actual type replaced in place of the type parameter) and the synthetic method.
> When it comes to the @Observes annotation, Arquillian will try to call the synthetic method (which receives Object) with any kind of event, leading to a ClassCastException (because the bridge method does an implicit cast to the actual type and calls the real generic method)
> The commit makes Arquillian ignore synthetic methods when searching for potential event listeners.
> Discussion:
>     http://discuss.arquillian.org/t/moving-from-persistence-impl-to-persistence-dbunit-with-openejb-embedded-4/294/7
>     
> See following bugs for details:
>     
> * http://bugs.java.com/view_bug.do?bug_id=6695379
> * http://bugs.java.com/view_bug.do?bug_id=8072365



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the arquillian-issues mailing list