Hi Emily,
I disagree, at least it doesn't add any new ambiguous injections. The use-case is
specifically to Specialized/Alternative beans. Right now inheritance of managed beans is
itself problematic, as injecting the base class can cause these ambiguous resolutions.
The example I sent out actually works correctly (in weld at least), really my propose is
to remove the need to have Produces a second time and update the spec to clarify what
happens here (FWIW, I don't believe the case is currently described in the spec),
hopefully to say that qualifiers and scopes from the base method remain in effect, unless
explicitly overridden.
John
________________________________
From: Emily Jiang <EMIJIANG(a)uk.ibm.com>
Sent: Sunday, September 11, 2016 5:59 PM
To: John Ament
Cc: cdi-dev
Subject: Re: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?
I think this is very problematic as you will get AmbiguousResolutionException all the time
once we introduce this inheritance.
Many thanks,
Emily
===========================
Emily Jiang
WebSphere Application Server, CDI Development Lead
MP 211, DE3A20, Winchester, Hampshire, England, SO21 2JN
Phone: +44 (0)1962 816278 Internal: 246278
Email: emijiang(a)uk.ibm.com
Lotus Notes: Emily Jiang/UK/IBM@IBMGB
From: John Ament <john.ament(a)spartasystems.com>
To: cdi-dev <cdi-dev(a)lists.jboss.org>
Date: 11/09/2016 20:04
Subject: [cdi-dev] Should javax.enterprise.inject.Produces be inherited?
Sent by: cdi-dev-bounces(a)lists.jboss.org
________________________________
All,
I was just thinking about alternatives and producer methods. Suppose I have the following
bean:
@ApplicationScoped
public class Boop {
@Produces
@ApplicationScoped
public Simpler makeSimpler() {
return new Simpler("Boop");
}
}
If I want to override the producer method, I need to declare fully:
@Alternative
@Priority(100)
@ApplicationScoped
public class BoopAlternative extends Boop{
@Override
@Produces
public Simpler makeSimpler() {
return new Simpler("Boop2");
}
}
For some reason, scopes are inherited, but the produces annotation is not. At least in
the case of a producer method, it seems like it would be useful for @Produces to be
inherited as well.
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
cdi-dev(a)lists.jboss.org
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 Info Page - JBoss
Developer<https://lists.jboss.org/mailman/listinfo/cdi-dev>
lists.jboss.org
List to discuss the development of CDI (the specification) To see the collection of prior
postings to the list, visit the cdi-dev Archives.
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
________________________________
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.