[cdi-dev] [JBoss JIRA] (CDI-608) Fix generics used within addObserverMethod

Martin Kouba (JIRA) issues at jboss.org
Fri May 27 08:46:00 EDT 2016


    [ https://issues.jboss.org/browse/CDI-608?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13244010#comment-13244010 ] 

Martin Kouba commented on CDI-608:
----------------------------------

I'm not sure. But we need the complete information to simulate the problem.

> Fix generics used within addObserverMethod
> ------------------------------------------
>
>                 Key: CDI-608
>                 URL: https://issues.jboss.org/browse/CDI-608
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>            Reporter: John Ament
>
> the following code doesn’t compile:
> {code}
> cdiEventEndpoints.values().stream().forEach(endpoint -> abd.addObserverMethod()
>     .beanClass(CdiEventComponent.class)
>     .observedType(endpoint.getType())
>     .qualifiers(endpoint.getQualifiers())
>     .notifyWith(endpoint::notify);
> {code}
> I need to write:
> {code}
> cdiEventEndpoints.values().stream().forEach(endpoint -> addCdiEventObserver(abd, endpoint));
> private <T> void addCdiEventObserver(AfterBeanDiscovery abd, CdiEventEndpoint<T> endpoint) {
>     abd.<T>addObserverMethod()
>         .beanClass(CdiEventComponent.class)
>         .observedType(endpoint.getType())
>         .qualifiers(endpoint.getQualifiers())
>         .notifyWith(endpoint::notify);
> }
> {code}



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



More information about the cdi-dev mailing list