[cdi-dev] [JBoss JIRA] (CDI-502) Clarify "contains" meaning in "Legal bean types" specification.

Tomasz Krakowiak (JIRA) issues at jboss.org
Thu Jan 29 04:39:49 EST 2015


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

Tomasz Krakowiak commented on CDI-502:
--------------------------------------

{quote}
An actual type is a type that is not a wildcard nor an unresolved type variable. There is therefore no rule in 5.2.4 where a wildcard would be considered on the bean type side.
{quote}
Thanks, now I understand.

It would be nice if legal bean types would be the types you can instantiate in Java (That doesn't covers all types a variable can have(eg. `List<? extends Optional<?>>`), but covers types, like `List<Optional<?>>`). And assignability to be exactly the same what in Java is with the exception for raw generic types.

I guess I could report feature request.

{quote}
Correct. Not sure why it is so.
{quote}
Should I report it as a clarification or bug?

> Clarify "contains" meaning in "Legal bean types" specification.
> ---------------------------------------------------------------
>
>                 Key: CDI-502
>                 URL: https://issues.jboss.org/browse/CDI-502
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Beans, Inheritance and Specialization
>            Reporter: Tomasz Krakowiak
>
> CDI 1.1, section 2.2.1. Legal bean types says:
> {quote}
> A parameterized type that contains a wildcard type parameter is not a legal bean type.
> {quote}
> Does it means direct containment or deep/recursive containment?
> I understand this is clearly illegal:
> {code}
> @Produces
> List<?> produceList(){
> //...
> }
> {code}
> But, are those two bean definitions legal:
> {code}
> @Produces
> List<Optional<?>> produceList(){
> //...
> }
> {code}
> {code}
> // Bean types: MyList, List<Optional<?>>, Object
> // or
> // Bean types: MyList, Object
> @Dependent
> MyList extends List<Optional<?>> {
> //...
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the cdi-dev mailing list