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

InjectionPoint.getQualifiers does not return the list of selected qualifiers with programmatic lookup

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.3
    • Fix Version/s: 1.7.0
    • Component/s: Core
    • Labels:
      None

      Description

      With a @Dependent producer method retrieving the InjectionPoint instance in case of a programmatic lookup, the method InjectionPoint.getQualifiers does not return the subset of qualifiers specified in during the lookup with Instance.select.

      The following test case:

      @RunWith(Arquillian.class)
      public class OwbTest {
      
          @Deployment
          public static Archive<?> deployment() {
              return ShrinkWrap.create(JavaArchive.class)
                  // Test class
                  .addClass(Beans.class)
                  // Bean archive deployment descriptor
                  .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
          }
      
          @Any
          @Inject
          Instance<String> strings;
      
          @Test
          public void test() {
              System.out.println(strings.select(new AnnotationLiteral<MyQualifier>() {
              }).get());
          }
      }
      
      class Beans {
      
          @Produces
          @MyQualifier
          String producer(InjectionPoint ip) {
              return Objects.toString(ip.getQualifiers());
          }
      }
      
      @Qualifier
      @Retention(RetentionPolicy.RUNTIME)
      @interface MyQualifier {
      
      }
      

      Outputs:

      [@javax.enterprise.inject.Any()]
      

      While it would be expected to outputs:

      [@MyQualifier(), @javax.enterprise.inject.Any()]
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                romain.manni-bucau Romain Manni-Bucau
                Reporter:
                antonin.stefanutti Antonin Stefanutti
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: