Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-331

Instance.iterator() shouldn't include non-alternatives that haven't been replaced

XMLWordPrintable

      The specification currently says that:

      The iterator() method must:
      • Identify the set of beans that have the required type and required qualifiers and are eligible for injection into the class into
      which the parent Instance was injected, according to the rules of typesafe resolution, as defined in Section 5.2.1.

      The ambiguity resolution algorithm as defined in 5.2.2 should be applied.

      This is explicitly required for get() but is not required for iterator(). This causes the following inconsistency:

      Assume two classes Foo and Bar which both implement common interface Common. Bar is an enabled alternative.

      Assume further the following

      @Inject @Any Instance<Common> instance
      

      injection point.

      It is clear that instance.get() returns Bar.

      It is however not clear whether instance.iterator() iterates over:
      a) Bar
      b) Foo, Bar

      and whether instance.isAmbiguous() returns:
      a) true
      b) false

              asabotdu@redhat.com Antoine Sabot-Durand (Inactive)
              rhn-engineering-jharting Jozef Hartinger
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: