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@uk.ibm.com
Lotus Notes: Emily Jiang/UK/IBM@IBMGB
From:
John Ament <john.ament@spartasystems.com>
To:
cdi-dev <cdi-dev@lists.jboss.org>
Date:
11/09/2016 20:04
Subject:
[cdi-dev] Should
javax.enterprise.inject.Produces be inherited?
Sent by:
cdi-dev-bounces@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@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.
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