You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "John D. Ament (JIRA)" <ji...@apache.org> on 2017/09/17 15:36:00 UTC

[jira] [Created] (OWB-1216) InjectionPoint.getType() returns wrong type for produced beans

John D. Ament created OWB-1216:
----------------------------------

             Summary: InjectionPoint.getType() returns wrong type for produced beans
                 Key: OWB-1216
                 URL: https://issues.apache.org/jira/browse/OWB-1216
             Project: OpenWebBeans
          Issue Type: Bug
            Reporter: John D. Ament


Assuming I have a producer (same thing happens for a custom registered 3rd party bean, this is just easier to demonstrate):

{code}
    public class MyProducer {
        @Produces
        @SomeQualifier
        public String doProducer(InjectionPoint ip) {
            return ip.getType().toString();
        }
    }
{code}

As well as the following injection point (with test):

{code}    
    @Inject
    @SomeQualifier
    private String myString;
    
    @Test
    public void shouldBeStringType() {
        assertThat(myString).isEqualTo(String.class.toString());
    }
{code}

The expectation is that the value of {{myString}} is {{java.lang.String}} but actually the value is the producer {{MyProducer}}.  We should be relying on the injection point's value, not the producer class.  It seems that it uses the value of {{getBeanClass}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)