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

John Ament (JIRA) issues at jboss.org
Thu May 26 21:15:00 EDT 2016


John Ament created CDI-608:
------------------------------

             Summary: 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