[weld-dev] Legal bean type question

Matej Novotny manovotn at redhat.com
Wed May 27 04:26:53 EDT 2020


Once again, please post questions like these to weld-dev mailing list.

To answer you, I think both of the predicates would be illegal bean types.
It doesn't matter if you actually "hide" the wildcard inside another parameter type. 
Whole type is checked in the end and if you stumble on a wildcard, it should become illegal bean type.

Matej

----- Original Message -----
> From: "Laird Nelson" <ljnelson at gmail.com>
> To: "Matej Novotny" <manovotn at redhat.com>
> Sent: Tuesday, May 26, 2020 6:16:04 PM
> Subject: Legal bean type question
> 
> Hello; I had a legal bean type question.
> 
> Section 2.2.1 says
> <https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#legal_bean_types>
> :
> 
> "A parameterized type that *contains* a wildcard type parameter is not a
> legal bean type."
> 
> I understand that therefore this is not a legal bean type:
> 
> Predicate<? super String> // oops, Predicate is parameterized with a
> wildcard
> 
> 
> Does "contains" also mean that *this* is not a legal bean type:
> 
> Predicate<List<? extends String>> // hmm; does Predicate "contain" ?
> extends String
> 
> 
> …?  Note that the parameterized type's type parameter is not itself a
> wildcard.
> 
> Best,
> Laird
> 



More information about the weld-dev mailing list