You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Cergey Chaulin (JIRA)" <ji...@apache.org> on 2019/06/23 09:29:00 UTC

[jira] [Commented] (OWB-1292) StackOverflowError in GenericsUtil.satisfiesDependency with parametrized type

    [ https://issues.apache.org/jira/browse/OWB-1292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16870505#comment-16870505 ] 

Cergey Chaulin commented on OWB-1292:
-------------------------------------

HI, thanks,

As I undestand, the bean FooImpl in my example should be injected ?

> StackOverflowError in GenericsUtil.satisfiesDependency with parametrized type
> -----------------------------------------------------------------------------
>
>                 Key: OWB-1292
>                 URL: https://issues.apache.org/jira/browse/OWB-1292
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Core
>            Reporter: Cergey Chaulin
>            Assignee: Romain Manni-Bucau
>            Priority: Major
>             Fix For: 2.0.12
>
>
> When trying to inject parametrized bean to concrete required type (like the one below), StackOverflowError occures in GenericsUtil.satisfiesDependency
> {code:java}
> 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}
> Code to reproduce:
> {code:java}
>   //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);
> {code}
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)