Expected value of getType() for the injection point of an Instance object

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Expected value of getType() for the injection point of an Instance object

John Ament

Hi,


I found a small issue within OWB.  The closest found TCK test (found by Romain) is https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L99 which tests the Instance type, but not the value of InjectionPoint.getType().  What should be the return value of getType() here?


John



NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this message, and destroy all physical and electronic copies. Thank you.
_______________________________________________
cdi-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/cdi-dev

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
Reply | Threaded
Open this post in threaded view
|

Re: Expected value of getType() for the injection point of an Instance object

Martin Kouba
Hi John,

I believe it should be the required type of the injected Instance (which
is the type parameter specified at the injection point - defined in
"5.6.1. The Instance interface" and "5.5.7. Injection point metadata")
unless you modify the type using Instance.select().

getType() is tested in:
https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L74 
and line 75

getQualifiers():
https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L86 
and line 87

Martin

Dne 11.9.2017 v 12:40 John Ament napsal(a):

> Hi,
>
>
> I found a small issue within OWB.  The closest found TCK test (found by
> Romain) is
> https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L99 which
> tests the Instance type, but not the value of InjectionPoint.getType().
>   What should be the return value of getType() here?
>
>
> John
>
>
> ------------------------------------------------------------------------
> NOTICE: This e-mail message and any attachments may contain
> confidential, proprietary, and/or privileged information which should be
> treated accordingly. If you are not the intended recipient, please
> notify the sender immediately by return e-mail, delete this message, and
> destroy all physical and electronic copies. Thank you.
>
>
> _______________________________________________
> cdi-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>

--
Martin Kouba
Senior Software Engineer
Red Hat, Czech Republic
_______________________________________________
cdi-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/cdi-dev

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
Reply | Threaded
Open this post in threaded view
|

Re: Expected value of getType() for the injection point of an Instance object

John Ament

Martin,


Sorry, but I'm looking for a concrete answer.  The tests you point to never test when the injection point is an Instance<> or Provider<>, e.g. the CDI built in beans.


What I'm looking for would be something like "It should be a ParameterizedType impl that represents Instance<Foo>" or "It should be the class Foo.class" or something else along those lines.


Thanks,


John




From: Martin Kouba <[hidden email]>
Sent: Monday, September 11, 2017 7:00 AM
To: John Ament; cdi-dev
Subject: Re: [cdi-dev] Expected value of getType() for the injection point of an Instance object
 
Hi John,

I believe it should be the required type of the injected Instance (which
is the type parameter specified at the injection point - defined in
"5.6.1. The Instance interface" and "5.5.7. Injection point metadata")
unless you modify the type using Instance.select().

getType() is tested in:
https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L74

and line 75

getQualifiers():
https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L86

and line 87

Martin

Dne 11.9.2017 v 12:40 John Ament napsal(a):
> Hi,
>
>
> I found a small issue within OWB.  The closest found TCK test (found by
> Romain) is
> https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L99 which

> tests the Instance type, but not the value of InjectionPoint.getType().
>   What should be the return value of getType() here?
>
>
> John
>
>
> ------------------------------------------------------------------------
> NOTICE: This e-mail message and any attachments may contain
> confidential, proprietary, and/or privileged information which should be
> treated accordingly. If you are not the intended recipient, please
> notify the sender immediately by return e-mail, delete this message, and
> destroy all physical and electronic copies. Thank you.
>
>
> _______________________________________________
> cdi-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/cdi-dev

>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.

>

--
Martin Kouba
Senior Software Engineer
Red Hat, Czech Republic

NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this message, and destroy all physical and electronic copies. Thank you.
_______________________________________________
cdi-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/cdi-dev

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
Reply | Threaded
Open this post in threaded view
|

Re: Expected value of getType() for the injection point of an Instance object

Matej Novotny
Hi John,

not sure I grasp your question, but the test line Martin pointed you to:

> assertEquals(bar.getFoo().getInjectionPoint().getType(), Foo.class);

makes it IMO pretty clear.

In case of @Inject Instance<Foo>, the expected result in the test is `Foo.class`.
You need to make use of the InjectionPoint in order to be able to retrieve this information.
There is no way to directly call getType() on Instance - there is no such method.
However, you can make use of the InjectionPoint; in this case the IP is Instance<Foo>.

Hope this is what you were after.

Matej

----- Original Message -----

> From: "John Ament" <[hidden email]>
> To: "cdi-dev" <[hidden email]>
> Sent: Monday, September 11, 2017 1:25:27 PM
> Subject: Re: [cdi-dev] Expected value of getType() for the injection point of an Instance object
>
>
>
> Martin,
>
>
>
>
> Sorry, but I'm looking for a concrete answer. The tests you point to never
> test when the injection point is an Instance<> or Provider<>, e.g. the CDI
> built in beans.
>
>
>
>
> What I'm looking for would be something like "It should be a
> ParameterizedType impl that represents Instance<Foo>" or "It should be the
> class Foo.class" or something else along those lines.
>
>
>
>
> Thanks,
>
>
>
>
> John
>
>
>
>
>
>
> From: Martin Kouba <[hidden email]>
> Sent: Monday, September 11, 2017 7:00 AM
> To: John Ament; cdi-dev
> Subject: Re: [cdi-dev] Expected value of getType() for the injection point of
> an Instance object
> Hi John,
>
> I believe it should be the required type of the injected Instance (which
> is the type parameter specified at the injection point - defined in
> "5.6.1. The Instance interface" and "5.5.7. Injection point metadata")
> unless you modify the type using Instance.select().
>
> getType() is tested in:
> https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L74
>
> and line 75
>
> getQualifiers():
> https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L86
>
> and line 87
>
> Martin
>
> Dne 11.9.2017 v 12:40 John Ament napsal(a):
> > Hi,
> >
> >
> > I found a small issue within OWB. The closest found TCK test (found by
> > Romain) is
> > https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L99
> > which
>
> > tests the Instance type, but not the value of InjectionPoint.getType().
> > What should be the return value of getType() here?
> >
> >
> > John
> >
> >
> > ------------------------------------------------------------------------
> > NOTICE: This e-mail message and any attachments may contain
> > confidential, proprietary, and/or privileged information which should be
> > treated accordingly. If you are not the intended recipient, please
> > notify the sender immediately by return e-mail, delete this message, and
> > destroy all physical and electronic copies. Thank you.
> >
> >
> > _______________________________________________
> > cdi-dev mailing list
> > [hidden email]
> > https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> >
> > Note that for all code provided on this list, the provider licenses the
> > code under the Apache License, Version 2 (
> > http://www.apache.org/licenses/LICENSE-2.0.html ). For all other ideas
> > provided on this list, the provider waives all patent and other
> > intellectual property rights inherent in such information.
>
> >
>
> --
> Martin Kouba
> Senior Software Engineer
> Red Hat, Czech Republic
>
> NOTICE: This e-mail message and any attachments may contain confidential,
> proprietary, and/or privileged information which should be treated
> accordingly. If you are not the intended recipient, please notify the sender
> immediately by return e-mail, delete this message, and destroy all physical
> and electronic copies. Thank you.
>
> _______________________________________________
> cdi-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code
> under the Apache License, Version 2
> (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other intellectual
> property rights inherent in such information.
_______________________________________________
cdi-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/cdi-dev

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
Reply | Threaded
Open this post in threaded view
|

Re: Expected value of getType() for the injection point of an Instance object

Martin Kouba
In reply to this post by John Ament
I'm sorry John but if you need concrete answer you should provide
concrete  instructions.

In the TCK test there is @Dependent Foo which injects InjectionPoint and
then the test does @Inject @Any Instance<Foo>, obtains the Foo instance
and inspects the InjectionPoint metadata. In fact, bar.getFoo() returns
a child Instance<Foo> with additional qualifier @Default. So it should
Foo.class.

Martin

Dne 11.9.2017 v 13:25 John Ament napsal(a):

> Martin,
>
>
> Sorry, but I'm looking for a concrete answer.  The tests you point to
> never test when the injection point is an Instance<> or Provider<>, e.g.
> the CDI built in beans.
>
>
> What I'm looking for would be something like "It should be a
> ParameterizedType impl that represents Instance<Foo>" or "It should be
> the class Foo.class" or something else along those lines.
>
>
> Thanks,
>
>
> John
>
>
>
> ------------------------------------------------------------------------
> *From:* Martin Kouba <[hidden email]>
> *Sent:* Monday, September 11, 2017 7:00 AM
> *To:* John Ament; cdi-dev
> *Subject:* Re: [cdi-dev] Expected value of getType() for the injection
> point of an Instance object
> Hi John,
>
> I believe it should be the required type of the injected Instance (which
> is the type parameter specified at the injection point - defined in
> "5.6.1. The Instance interface" and "5.5.7. Injection point metadata")
> unless you modify the type using Instance.select().
>
> getType() is tested in:
> https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L74 
>
>
> and line 75
>
> getQualifiers():
> https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L86 
>
>
> and line 87
>
> Martin
>
> Dne 11.9.2017 v 12:40 John Ament napsal(a):
>> Hi,
>>
>>
>> I found a small issue within OWB.  The closest found TCK test (found by
>> Romain) is
>> https://github.com/cdi-spec/cdi-tck/blob/master/impl/src/main/java/org/jboss/cdi/tck/tests/lookup/injectionpoint/dynamic/DynamicInjectionPointTest.java#L99 
> which
>
>> tests the Instance type, but not the value of InjectionPoint.getType().
>>   What should be the return value of getType() here?
>>
>>
>> John
>>
>>
>> ------------------------------------------------------------------------
>> NOTICE: This e-mail message and any attachments may contain
>> confidential, proprietary, and/or privileged information which should be
>> treated accordingly. If you are not the intended recipient, please
>> notify the sender immediately by return e-mail, delete this message, and
>> destroy all physical and electronic copies. Thank you.
>>
>>
>> _______________________________________________
>> cdi-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
>>
>> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
>
>>
>
> --
> Martin Kouba
> Senior Software Engineer
> Red Hat, Czech Republic
> ------------------------------------------------------------------------
> NOTICE: This e-mail message and any attachments may contain
> confidential, proprietary, and/or privileged information which should be
> treated accordingly. If you are not the intended recipient, please
> notify the sender immediately by return e-mail, delete this message, and
> destroy all physical and electronic copies. Thank you.
>
>
> _______________________________________________
> cdi-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>

--
Martin Kouba
Senior Software Engineer
Red Hat, Czech Republic
_______________________________________________
cdi-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/cdi-dev

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.