Uploaded image for project: 'CDI TCK'
  1. CDI TCK
  2. CDITCK-591

AlternativeMetadataTest createVegetables and destroyVegetables violate Type Closure rules

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 2.0.0.Final
    • Tests
    • None

      This test has actually quite a few shortcomings.

      It modifies the AnnotatedType for the createVegetables producer method to have a TypeClosure of

      {Carrot.class} (Carrot implements Vegetables).

      The problem is that this violates the rules for type closures (2.2).
      Type closures is by default the bean type and all it's interfaces, parent classes, etc. One can further restrict those classes via @Typed or by modifying the AnnotatedType.
      But it imo not allowed to have a Type in the TypeClosures which is not contained in e.g. the return type of a producer method.

      In the TCK test the producer method returns Vegetables and the test modifies it to a type closure of {Carrot.class}

      . So what happens if the producer method returns a new Tomato() ?

      The other point is that for matching producers and disposers the type closures is not taken into account as per the spec, but only the return type and the type of the dispose parameter.
      See

      3.4.1. Disposed parameter of a disposer method
      Each disposer method must have exactly one disposed parameter, of the same type as the corresponding producer method return type or producer field type.

            Unassigned Unassigned
            struberg Mark Struberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: