]
Matej Novotny updated CDI-673:
------------------------------
Fix Version/s: 2.0 .Final
Revisit manipulation with InjectionPoint(s) in ProducerConfigurator
-------------------------------------------------------------------
Key: CDI-673
URL:
https://issues.jboss.org/browse/CDI-673
Project: CDI Specification Issues
Issue Type: Bug
Affects Versions: 2.0.Beta1
Reporter: Matej Novotny
Fix For: 2.0 .Final
Currently, {{ProducerConfigurator}} allows to add or replace injection points.
Firstly, {{addInjectionPoints}} - if you think about this, it does not really make sense.
You already have producer method defined, it has some body and uses its parameter within
that method body. So if you add any IP, the method would not make use of it anyway.
Secondly, replacing IP with {{injectionPoints}} - now this seems useful, but in fact it
won't work. As it stands, replacing them in Weld only affects validation phase, not
the injection itself. This means that if you have following producer:
{code}
@Produces public Foo produceIt (@Default Bar) { //do stuff}
{code}
and meant to replace the parameter with, say, {{@MyCustom Bar}}, you would in the end
still end up with {{@Default Bar}}.
The problem here is that
[
spec|http://docs.jboss.org/cdi/spec/2.0.EDR2/cdi-spec.html#injectiontarget] states the
following:
bq. Implementations of Producer and InjectionTarget must ensure that the set of injection
points returned by getInjectionPoints() are injected by produce() or inject().
However, spec says nothing about what should happen when you change implementation's
set on IPs later.
Note: I think we bumped into similar issue with {{BeanConfigurator}} (or some other
configurator as well). I will try to dig up that discussion.