Uploaded image for project: 'Errai'
  1. Errai
  2. ERRAI-1062

Errai dependency resolution algorithm is wrong for type variables

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0.0.Final
    • Fix Version/s: None
    • Component/s: ErraiIOC
    • Labels:
      None

      Description

      Parameterized types in Java are invariant (i.e. List<B> is not assignable to List<A> even if B is assignable to A).

      But if Errai has a bean of type List<B> it will resolve it as satisfying List<A>. This is not what Weld does. In Weld it is up to an injection site to specify if it is covariant/contravariant by using a wildcard like the following:

      @Inject List<? extends A> covariant;
      @Inject List<? super A> contravariant;
      @Inject List<A> invariant;
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                mbarkley Max Barkley
                Reporter:
                mbarkley Max Barkley
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: