Just to help me understand how we view parameterized types that have wildcards.
Which of these producers are valid?
@Produces
public Consumer<? extends Number> assignableToNumber() {
return null;
}
"If a producer method return type contains a wildcard type parameter or is an array type whose component type contains a wildcard type parameter, the container automatically detects the problem and treats it as a definition error."
Similar provision exists for producer fields. For managed beans, there's no need for such a rule, because 1. you can't extend or implement a parameterized type whose type argument is a wildcard type, 2. a parameterized type that contains a wildcard is not a legal bean type per
https://jakarta.ee/specifications/cdi/4.0/jakarta-cdi-spec-4.0.html#legal_bean_types and hence would be removed from the set of bean types anyway.
@Produces
public Consumer<Number> number() {
return null;
}
Valid.
Which of these observers are valid?
public void assignableToNumber(@Observes Consumer<? extends Number> assignableToNumber) {
}
public void number(@Observes Consumer<Number> number) {
}
Both are valid.
Which of these injection points are valid?
@Inject
Consumer<? extends Number> assignableToNumber;
@Inject
Consumer<Number> number;
Both are valid.
Hope that helps.
LT
-David
Hi,
all tests in the TCK should "say what part of the spec" they test using the `@SpecAssertion` annotation. If there's a test without this annotation, that's a bug.
Now, this test _does_ have `@SpecAssertion`s, so you can find which part of the spec they test in the tck-audit-*.xml files. For example, `beanSetOfBeanTypesContainsOnlyLegalTypes` verifies that "The resulting set of bean types for a managed bean consists only of legal bean types, all other types are removed from the set of bean types."
LT
_______________________________________________
cdi-dev mailing list
cdi-dev@xxxxxxxxxxxTo unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/cdi-dev
_______________________________________________
cdi-dev mailing list
cdi-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdi-dev