<div dir="ltr"><div><div><div>Hey all,<br><br></div>I have a problem with &quot;Faking an injection point,&quot; with the current Weld 2 code, seems to be throwing an NPE instead of using the InjectionPoint that I am providing the BeanManager with.<br>
<br></div>This can be reproduced right now by checking out the forge core repository branch 2.0. Just run, mvn clean install.<br><br><a href="https://github.com/forge/core/tree/2.0">https://github.com/forge/core/tree/2.0</a><br>
<br></div><div>The crux of the matter, we have a producer method in a CDI instance A:<br><span style="font-family:courier new,monospace"><br>@Produces<br>public static Coverter&lt;?,?&gt; produceRemoteConverter(AddonRegistry registry, InjectionPoint ip)</span><br>
<br></div><div>There are, however, no injection points actually consuming this type/producer method from within CDI instance A. (And adding one would not really help.)<br></div><div><br>In CDI instance, B, however, we are using the following code, with a reference to the BeanManager from CDI instance A, to get an instance of a Converter:<br>
<br><span style="font-family:courier new,monospace">Bean&lt;R&gt; bean = (Bean&lt;R&gt;) manager.resolve(manager.getBeans(type));<br>context = manager.createCreationalContext(bean);<br>Object delegate = manager.getInjectableReference(injectionPoint, context);</span><br>
<br></div><div>We have an InjectionPoint for the Converter type in CDI instance B, and are delegating to container A to get the instance (using an extension.)<br><br></div><div>However, even though we are passing in our own InjectionPoint(B) into CDI instance A, CDI instance A still tries to look up the InjectionPoint on its internal stack, and throws a NullpointerException.<br>
<br></div><div>I think this is a bug, since InjectionPoint is an interface, (but obviously very edge case if so.)<br><br></div><div>Any help would be appreciated. Otherwise, we have no way to support looking up beans for types which are produced with Producer Methods requiring an injection point (those without work fine, and normal type lookups obviously work fine.)<br clear="all">
</div><div><div><div><div><br>-- <br>Lincoln Baxter, III<br><a href="http://ocpsoft.org" target="_blank">http://ocpsoft.org</a><br>&quot;Simpler is better.&quot;
</div></div></div></div></div>