Re: [weld-dev] Potential bug with Typed not affecting if a ProducerMethod is proxiable.

2018-03-15 Thread Martin Kouba
It is true that @Typed is only used to restrict the set of bean types 
used during resolution. And so it has no direct effect on proxyability 
checks, except that WELD-2466 is about the fact that Weld incorrectly 
checks all the bean types of a bean in 
BeanManager#getInjectableReference. So Benjamin's attempt makes some 
sense ;-). Unfortunately, it seems the only way to fix this is the PR 
attached to WELD-2466.

Martin

Dne 13.3.2018 v 10:36 Matej Novotny napsal(a):
> Hi,
> 
> comments inline.
> 
> Matej
> 
> - Original Message -
>> From: "Benjamin Confino" 
>> To: weld-dev@lists.jboss.org
>> Cc: "Emily Jiang" 
>> Sent: Monday, March 12, 2018 6:40:27 PM
>> Subject: [weld-dev] Potential bug with Typed not affecting if a  
>> ProducerMethod is proxiable.
>>
>> Hello
>>
>> I can see something that might be a bug in weld. I attempted to work
>> around https://issues.jboss.org/projects/WELD/issues/WELD-2466 by using
>> the@Typed annotation on a Producer Method to exclude the unproxiable Types
>> and thus avoid getting caught by the failing isBeanProxiable check.
>> However the annotation did not affect whether or not the ProducerMethod is
>> proxiable. This might be a second bug.
>>
>> I have uploaded a recreate application which I have verified against
>> Wildfly 11.0.0 here: https://github.com/benjamin-confino/TypedProducerBug
> 
> Thanks for reproducer, checking it now.
> 
>>
>> To recreate you can download the pre-compiled binary from github, deploy
>> it to a version of Wildfly without the fix for WELD-2466, and visit the
>> url http://localhost:8080/WeldRecreateProducesExtendedAbstract/inheritance
>> this will trigger a call to getInjectableReference() which will fail
>> because the ProducerMethod for recreate.BeanProducer.produceBean() is not
>> proxiable.
>>
>> If you debug into constructor for ProducerMethod at line 76 you will see
>> that the proxiable flag is set using method.getTypeClosures() ; which
>> returns all the associated types, rather than just those specified with
>> the Typed() paramater.
>>
>> Is this the correct behaviour? Should a ProducerMethod be unproxiable even
>> with Typed limiting the bean types to proxiable types?
> 
> I think this is correct behaviour because:
> * Weld needs to proxy whole class hierarchy, we cannot just skip one 
> underlying class when creating the proxy object
> * @Typed is then used to determine where can this bean be injected, e.g. 
> which bean types are used to match it against required types of each 
> injection point
> 
> Therefore, @Typed is not really connected to proxyability but rather to 
> assignability of that produced bean to a given injection point.
> 
> I'll double check this but I really think it's correct behaviour.
> 
>>
>> Regards
>> Benjamin
>> Unless stated otherwise above:
>> IBM United Kingdom Limited - Registered in England and Wales with number
>> 741598.
>> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
>>
>> ___
>> weld-dev mailing list
>> weld-dev@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/weld-dev
> ___
> weld-dev mailing list
> weld-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
> 

-- 
Martin Kouba
Senior Software Engineer
Red Hat, Czech Republic
___
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev


Re: [weld-dev] Potential bug with Typed not affecting if a ProducerMethod is proxiable.

2018-03-13 Thread Benjamin Confino
Thank you Matej that's good to know. 



From:   Matej Novotny 
To: Benjamin Confino 
Cc: weld-dev@lists.jboss.org, Emily Jiang 
Date:   13/03/2018 09:36
Subject:        Re: [weld-dev] Potential bug with Typed not affecting if a 
ProducerMethod is proxiable.



Hi,

comments inline.

Matej

- Original Message -
> From: "Benjamin Confino" 
> To: weld-dev@lists.jboss.org
> Cc: "Emily Jiang" 
> Sent: Monday, March 12, 2018 6:40:27 PM
> Subject: [weld-dev] Potential bug with Typed not affecting if a  
ProducerMethod is proxiable.
> 
> Hello
> 
> I can see something that might be a bug in weld. I attempted to work
> around 
https://urldefense.proofpoint.com/v2/url?u=https-3A__issues.jboss.org_projects_WELD_issues_WELD-2D2466&d=DwICaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=hl8XiFr1UrTSgyXVc4KO_i51sM3Gyhlu1KZ4TkyseEQ&m=ScbAGiokKoG8J7UIq97SogIlYzc6sVEtHpdb4KOqFw8&s=Tv24CjpIwcNluyXRoaRewFcbDniYgUcUn6thtVXNjwY&e=
 
by using
> the@Typed annotation on a Producer Method to exclude the unproxiable 
Types
> and thus avoid getting caught by the failing isBeanProxiable check.
> However the annotation did not affect whether or not the ProducerMethod 
is
> proxiable. This might be a second bug.
> 
> I have uploaded a recreate application which I have verified against
> Wildfly 11.0.0 here: 
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_benjamin-2Dconfino_TypedProducerBug&d=DwICaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=hl8XiFr1UrTSgyXVc4KO_i51sM3Gyhlu1KZ4TkyseEQ&m=ScbAGiokKoG8J7UIq97SogIlYzc6sVEtHpdb4KOqFw8&s=7eRe_h7ECCu90QwZkeL2f8vjrGk8-Ky3F6KKRI9eroI&e=


Thanks for reproducer, checking it now.

> 
> To recreate you can download the pre-compiled binary from github, deploy
> it to a version of Wildfly without the fix for WELD-2466, and visit the
> url 
https://urldefense.proofpoint.com/v2/url?u=http-3A__localhost-3A8080_WeldRecreateProducesExtendedAbstract_inheritance&d=DwICaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=hl8XiFr1UrTSgyXVc4KO_i51sM3Gyhlu1KZ4TkyseEQ&m=ScbAGiokKoG8J7UIq97SogIlYzc6sVEtHpdb4KOqFw8&s=UBmyUqqsPVaalvwahMH_dEjkrRsQcwOheatneSMHVNQ&e=

> this will trigger a call to getInjectableReference() which will fail
> because the ProducerMethod for recreate.BeanProducer.produceBean() is 
not
> proxiable.
> 
> If you debug into constructor for ProducerMethod at line 76 you will see
> that the proxiable flag is set using method.getTypeClosures() ; which
> returns all the associated types, rather than just those specified with
> the Typed() paramater.
> 
> Is this the correct behaviour? Should a ProducerMethod be unproxiable 
even
> with Typed limiting the bean types to proxiable types?

I think this is correct behaviour because:
* Weld needs to proxy whole class hierarchy, we cannot just skip one 
underlying class when creating the proxy object
* @Typed is then used to determine where can this bean be injected, e.g. 
which bean types are used to match it against required types of each 
injection point

Therefore, @Typed is not really connected to proxyability but rather to 
assignability of that produced bean to a given injection point.

I'll double check this but I really think it's correct behaviour.

> 
> Regards
> Benjamin
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 
3AU
> 
> ___
> weld-dev mailing list
> weld-dev@lists.jboss.org
> 
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.jboss.org_mailman_listinfo_weld-2Ddev&d=DwICaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=hl8XiFr1UrTSgyXVc4KO_i51sM3Gyhlu1KZ4TkyseEQ&m=ScbAGiokKoG8J7UIq97SogIlYzc6sVEtHpdb4KOqFw8&s=zfPYGJTeMlNEu9b6uzEuu9Jh5DudVi-PdbzlGSY0EAg&e=





Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
___
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev

Re: [weld-dev] Potential bug with Typed not affecting if a ProducerMethod is proxiable.

2018-03-13 Thread Matej Novotny
Hi,

comments inline.

Matej

- Original Message -
> From: "Benjamin Confino" 
> To: weld-dev@lists.jboss.org
> Cc: "Emily Jiang" 
> Sent: Monday, March 12, 2018 6:40:27 PM
> Subject: [weld-dev] Potential bug with Typed not affecting if a   
> ProducerMethod is proxiable.
> 
> Hello
> 
> I can see something that might be a bug in weld. I attempted to work
> around https://issues.jboss.org/projects/WELD/issues/WELD-2466 by using
> the@Typed annotation on a Producer Method to exclude the unproxiable Types
> and thus avoid getting caught by the failing isBeanProxiable check.
> However the annotation did not affect whether or not the ProducerMethod is
> proxiable. This might be a second bug.
> 
> I have uploaded a recreate application which I have verified against
> Wildfly 11.0.0 here: https://github.com/benjamin-confino/TypedProducerBug

Thanks for reproducer, checking it now.

> 
> To recreate you can download the pre-compiled binary from github, deploy
> it to a version of Wildfly without the fix for WELD-2466, and visit the
> url http://localhost:8080/WeldRecreateProducesExtendedAbstract/inheritance
> this will trigger a call to getInjectableReference() which will fail
> because the ProducerMethod for recreate.BeanProducer.produceBean() is not
> proxiable.
> 
> If you debug into constructor for ProducerMethod at line 76 you will see
> that the proxiable flag is set using method.getTypeClosures() ; which
> returns all the associated types, rather than just those specified with
> the Typed() paramater.
> 
> Is this the correct behaviour? Should a ProducerMethod be unproxiable even
> with Typed limiting the bean types to proxiable types?

I think this is correct behaviour because:
* Weld needs to proxy whole class hierarchy, we cannot just skip one underlying 
class when creating the proxy object
* @Typed is then used to determine where can this bean be injected, e.g. which 
bean types are used to match it against required types of each injection point

Therefore, @Typed is not really connected to proxyability but rather to 
assignability of that produced bean to a given injection point.

I'll double check this but I really think it's correct behaviour.

> 
> Regards
> Benjamin
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
> 
> ___
> weld-dev mailing list
> weld-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
___
weld-dev mailing list
weld-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-dev