Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdi-dev] History of legal bean types?

I feel embarrassed asking this basic question as a newly-minted committer, but…well, I don't know the answer and I'm humble and so on and so on, and maybe someone else has the same question, and so here goes.  Kindly be gentle as you point out my mistakes.

The specification says:

"However, some Java types are not legal bean types :…A parameterized type that contains a wildcard type parameter is not a legal bean type."

(I've clarified on the weld-dev mailing list and via private correspondence that "contains" means containment at an arbitrarily deep level, i.e. if "?" appears anywhere in the parameterized type in question, no matter where.)

Why is this prohibited?

Suppose I have a class like this that gets discovered as a bean:

public class Foo implements Function<Gorp<?>, Blatz> {
 // everything else omitted for brevity
}

Why is Function<Gorp<?>, Blatz> an illegal bean type?  What state of affairs is prevented with this restriction?

To be clear, I'm sure there is a good reason for this; I just can't see it and am looking for clarification.

Best,
Laird

Back to the top