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

StackOverflowError in GenericsUtil.satisfiesDependency with parametrized type

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.12
    • Component/s: Core
    • Labels:
      None

      Description

      When trying to inject parametrized bean to concrete required type (like the one below), StackOverflowError occures in GenericsUtil.satisfiesDependency

      interface GenericFoo<T extends Comparable<T>> {
          T someMethod();
      }
      class FooImpl<T extends Comparable<T>> implements GenericFoo<T> {
      
          @Override
          public T someMethod() {
              return null;
          }
      }
      
      class Bar {
        GenericFoo<Long> foo;
      }

      Code to reproduce:

        //creating injection point of GenericFoo<Long>
        ParameterizedType injectionPointType = new OwbParametrizedTypeImpl(null, GenericFoo.class, Long.class);
        CoreReflectionFactory factory = CoreReflectionFactory.make(GenericFoo.class, ClassScope.make(GenericFoo.class));
      
        //constructing parametrized type manually
        TypeVariable<?> t = factory.makeTypeVariable("T", new FieldTypeSignature[]{
                ClassTypeSignature.make(Collections.singletonList(
                        SimpleClassTypeSignature.make(Comparable.class.getName(), false,
                                new TypeArgument[]{TypeVariableSignature.make("T")})))
        });
      
        ParameterizedType beanType = new OwbParametrizedTypeImpl(null, GenericFoo.class, t);
        GenericsUtil.satisfiesDependency(false, false, injectionPointType, beanType);
      

       

       

        Attachments

          Activity

            People

            • Assignee:
              romain.manni-bucau Romain Manni-Bucau
              Reporter:
              cossack5 Cergey Chaulin
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: