Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-868

Producer ArrayList<String> + producer List<Integer> = j.e.i.AmbiguousResolutionException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.8
    • 1.2.0
    • None
    • None
    • J2SE + IBM JDK 7

    Description

      With this bean that provides 2 producers that return 2 differents kinds of objects:
      @Produces
      @Named("list1")
      public ArrayList<String> getListe1()

      { return null; }

      @Produces
      @Named("list2")
      public List<Integer> getListe2() { return null; }

      And this bean that get injected one of the produced object:
      @Inject public List<Integer> listInteger;

      The application fails with "javax.enterprise.inject.AmbiguousResolutionException"

      Exception in thread "main" javax.enterprise.inject.AmbiguousResolutionException: Ambigious resolution
      found beans:
      List, Name:list2, WebBeans Type:PRODUCERMETHOD, API Types:[java.lang.Iterable,java.lang.Object,java.util.Collection,java.util.List], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]
      ArrayList, Name:list1, WebBeans Type:PRODUCERMETHOD, API Types:[java.util.AbstractList,java.util.ArrayList,java.util.RandomAccess,java.lang.Iterable,java.util.AbstractCollection,java.util.Collection,java.lang.Object,java.io.Serializable,java.util.List,java.util.Collection,java.lang.Iterable,java.util.List,java.lang.Cloneable], Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default,javax.inject.Named]

      If we change the return type of the firts producer from ArrayList by List, it works !!
      Check the attached zip

      Attachments

        1. OWB-868.zip
          2 kB
          Denis Forveille

        Activity

          People

            bergmark Joseph E Bergmark
            denis.forveille Denis Forveille
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: