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

OpenWebBeans 1.2.1 fails when injecting generic value holder

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.1
    • 1.2.1
    • Injection and Lookup
    • None

    Description

      In OmniFaces we're using a producer method with the following signature:

      @Produces
      @Param
      public <V> ParamValue<V> produce(InjectionPoint injectionPoint)
      

      Injection then takes place into a bean as follows:

      @Inject @Param
      private ParamValue<String> text1;
      

      @Param is a qualifier with only non-binding attributes.

      See RequestParameterProducer and Param

      This works in all versions of Weld that we tested on and in OpenWebBeans 1.1.8 (TomEE 1.5.2.). Unfortunately it does not work with OpenWebBeans 1.2.1-SNAPSHOT (TomEE 1.6.0-SNAPSHOT).

      The problem seems to be that 1.2.1 has added an additional check in org.apache.webbeans.util.GenericsUtil.satisfiesDependency that wasn't there before:

      return ClassUtil.isSame(injectionPointRawType, beanRawType)? isAssignableFrom(injectionPointType, beanType): false;
      

      The problem is with isAssignableFrom, because the producer is always seen as producing a ParamValue<Object. The actual values at the point of evaluation with the above given injection example where:

      injectionPoint = ParamValue<class java.lang.String> 
      beanType = ParamValue<class java.lang.Object>
      

      Those are not directly assignable so the injection fails.

      Is OmniFaces doing something wrong here, is this check to strict, or should the producer type not be seen as ParamValue<Object>?

      Attachments

        Activity

          People

            struberg Mark Struberg
            arjan.tijms Arjan Tijms
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: