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

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


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

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

What's the type of {{cdiEventEndpoints}}?

> 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