I think we have to look at 2 different pieces. The sentence quoted above regarding Disposer-Producer matching requires the exact same return type. Not Type Closures, it explicitly says "return type". This rule is violated by the example
I don't think this is violated in the test. The Grocery#createVegetable (wrapped by new AT - GroceryWrapper) returns type Carrot which reflects the corresponding assertion which states:
the container must call Annotated.getTypeClosure() to determine the bean types of any kind of bean,
The related disposal method has parameter with type Carrot as well (again it reflects corresponding assertion wrt Annotated.getBaseType()). I can't see anything wrong in this test.
The other point which is imo violated is that the type closure must only be a sub section of the original types.
Where is it defined? The test doesn't restrict any type closure set of any existing bean. It just creates custom AT which declares the given set of types. TCK is not very often about practical use but rather about testing spec assertions which sometimes mean to test real corner cases. |