[cdi-dev] [JBoss JIRA] (CDI-673) Revisit manipulation with InjectionPoint(s) in ProducerConfigurator

Matej Novotny (JIRA) issues at jboss.org
Fri Dec 16 10:16:00 EST 2016

Matej Novotny created CDI-673:

             Summary: 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

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:

@Produces public Foo produceIt (@Default Bar) { //do stuff}

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.

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list