[cdi-dev] [JBoss JIRA] (CDI-494) Clarify that a type variable that resolves to a wildcard is not resolvable

Antoine Sabot-Durand (JIRA) issues at jboss.org
Mon Mar 14 09:13:00 EDT 2016

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

Antoine Sabot-Durand commented on CDI-494:

Well guys, if it's technically possible to accept unbounded and bounded wildcards for events let's do it. It's probably a mistake to compare this restriction in event rules with restriction in type resolution for DI.
This said, when I read JLS [1] and this sentence :

{quote}Type arguments may be either reference types or wildcards. Wildcards are useful in situations where only partial knowledge about the type parameter is required.{quote}

My understanding is that {{List<? extends Number> }}is similar to {{List<T extends Number>}}. The only difference is that in the first version we won't need type information later.

OTHO List<?> (or List<? extends Object>) clearly defines a List containing any type... 

[1] https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.5.1

> Clarify that a type variable that resolves to a wildcard is not resolvable
> --------------------------------------------------------------------------
>                 Key: CDI-494
>                 URL: https://issues.jboss.org/browse/CDI-494
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Events
>    Affects Versions: 1.2.Final
>            Reporter: Jozef Hartinger
>             Fix For: 2.0 (discussion)
> This is implicit but I've seen people confused about this several times. See e.g. https://issues.jboss.org/browse/WELD-1799

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list