[cdi-dev] [JBoss JIRA] (CDI-674) Non-deterministic behavior of CDI.current()

Matej Novotny (JIRA) issues at jboss.org
Mon Jan 2 04:13:00 EST 2017

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

Matej Novotny commented on CDI-674:

Few more details - this was changed/fixed as a part of CDI-655 in [this PR|https://github.com/cdi-spec/cdi/pull/352].

> Non-deterministic behavior of CDI.current()
> -------------------------------------------
>                 Key: CDI-674
>                 URL: https://issues.jboss.org/browse/CDI-674
>             Project: CDI Specification Issues
>          Issue Type: Bug
>    Affects Versions: 2.0.Beta1
>            Reporter: John Ament
> The behavior of CDI.current() is not deterministic.  It uses {{findAny()}}.  It should use {{findFirst()}}
> {{.findAny().orElseThrow(() -> new IllegalStateException("Unable to access CDI"));}}
> This also seems to go against what the javadocs say
> bq. otherwise the first provider which can access the container is used.

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list