Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2643

Warning on log during call to BeanManager#isQualifier

    XMLWordPrintable

Details

    • Hide

      Run this program:

      package org.example;
      
      import org.jboss.weld.environment.se.Weld;
      import org.jboss.weld.environment.se.WeldContainer;
      
      import javax.ejb.Remote;
      import javax.enterprise.context.Dependent;
      
      public class Main {
      
       public static void main(String[] args) {
       try (WeldContainer seContainer = createCdiContainer()) {
       // WARN: WELD-001101: Member of array type or annotation type must be annotated @NonBinding: [EnhancedAnnotatedMethodImpl] public abstract javax.ejb.Remote.value()
       System.out.println(seContainer.getBeanManager().isQualifier(Remote.class));
       }
       }
      
       private static WeldContainer createCdiContainer() {
       return new Weld().disableDiscovery().addBeanClass(MyDummyBean.class).initialize();
       }
      
       @Dependent
       public static class MyDummyBean {}
      }
      Show
      Run this program: package org.example; import org.jboss.weld.environment.se.Weld; import org.jboss.weld.environment.se.WeldContainer; import javax.ejb.Remote; import javax.enterprise.context.Dependent; public class Main { public static void main( String [] args) { try (WeldContainer seContainer = createCdiContainer()) { // WARN: WELD-001101: Member of array type or annotation type must be annotated @NonBinding: [EnhancedAnnotatedMethodImpl] public abstract javax.ejb.Remote.value() System .out.println(seContainer.getBeanManager().isQualifier(Remote.class)); } } private static WeldContainer createCdiContainer() { return new Weld().disableDiscovery().addBeanClass(MyDummyBean.class).initialize(); } @Dependent public static class MyDummyBean {} }
    • Undefined

    Description

      When BeanManager#isQualifier is called with annotations that are not valid qualifiers, the warning with ID 001101 "Member of array type or annotation type must be annotated @NonBinding: [some attribute of the offending annotation]" appears in my log file. The message originates from org.jboss.weld.metadata.cache.QualifierModel.java:66.

       

      A warning is unnecessary in my opinion, at least in the context of BeanManager#isQualifier, because the occasional input that isn't an qualifier should be expected for this method. It should simply return false and nothing more.

       

      In my case, I'm developing an extension that at some point uses

      Arrays.stream(clazz.getAnnotations()).filter(annotation -> beanManager.isQualifier(annotation.annotationType()))

      to obtain all qualifiers of some type. Depending on the input this line spams my log with warnings that do not warn about a real problem.

      Attachments

        Activity

          People

            manovotn Matěj Novotný
            johannes-hahn Johannes Hahn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: