<style>
/* Changing the layout to use less space for mobiles */
@media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) {
    #email-body { min-width: 30em !important; }
    #email-page { padding: 8px !important; }
    #email-banner { padding: 8px 8px 0 8px !important; }
    #email-avatar { margin: 1px 8px 8px 0 !important; padding: 0 !important; }
    #email-fields { padding: 0 8px 8px 8px !important; }
    #email-gutter { width: 0 !important; }
}
</style>
<div id="email-body">
<table id="email-wrap" align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#f0f0f0;color:#000000;width:100%;">
    <tr valign="top">
        <td id="email-page" style="padding:16px !important;">
            <table align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#ffffff;border:1px solid #bbbbbb;color:#000000;width:100%;">
                <tr valign="top">
                    <td bgcolor="#3b4d64" style="background-color:#3b4d64;color:#ffffff;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;line-height:1;"><img src="https://issues.jboss.org/s/en_US-difko1-418945332/812/58/_/jira-logo-scaled.png" alt="" style="vertical-align:top;" /></td>
                </tr><tr valign="top">
    <td id="email-banner" style="padding:32px 32px 0 32px;">
        
                
        
        
            <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;">
    <tr valign="top">
        <td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;padding:0;">
                                        <img id="email-avatar" src="https://community.jboss.org/people/lincolnthree/avatar/16.png" alt="" height="48" width="48" border="0" align="left" style="padding:0;margin: 0 16px 16px 0;" />
                        <div id="email-action" style="padding: 0 0 8px 0;font-size:12px;line-height:18px;">
                                    <a class="user-hover" rel="lincolnthree" id="email_lincolnthree" href="https://issues.jboss.org/secure/ViewProfile.jspa?name=lincolnthree" style="color:#326ca6;">Lincoln Baxter III</a>
     created <img src="https://issues.jboss.org/images/icons/newfeature.gif" height="16" width="16" border="0" align="absmiddle" alt="Feature Request"> <a style='color:#326ca6;text-decoration:none;' href='https://issues.jboss.org/browse/WELD-1298'>WELD-1298</a>
            </div>
                        <div id="email-summary" style="font-size:16px;line-height:20px;padding:2px 0 16px 0;">
                <a style='color:#326ca6;text-decoration:none;' href='https://issues.jboss.org/browse/WELD-1298'><strong>NullPointerException thrown when using beanManager.getReference(...) or getInstance(...) where the Producer method for the bean is expecting an InjectionPoint.</strong></a>
            </div>
                    </td>
    </tr>
</table>
    </td>
</tr>
<tr valign="top">
    <td id="email-fields" style="padding:0 32px 32px 32px;">
        <table border="0" cellpadding="0" cellspacing="0" style="padding:0;text-align:left;width:100%;" width="100%">
            <tr valign="top">
                <td id="email-gutter" style="width:64px;white-space:nowrap;"></td>
                <td>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Issue Type:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                <img src="https://issues.jboss.org/images/icons/newfeature.gif" height="16" width="16" border="0" align="absmiddle" alt="Feature Request">        Feature Request
    </td>
</tr>                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Affects Versions:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                    2.0.0.Beta2            </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Assignee:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                                        <a class="user-hover" rel="jharting" id="email_jharting" href="https://issues.jboss.org/secure/ViewProfile.jspa?name=jharting" style="color:#326ca6;">Jozef Hartinger</a>
                </td>
</tr>                                                <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Components:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                    Producers (Methods, Fields and Disposers),                     Resolution (Typesafe and by Name)            </td>
</tr>
                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Created:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        12/Jan/13 3:08 PM
    </td>
</tr>                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Description:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        <p style='margin-top:0;margin-bottom:10px;'>I have a problem with the current Weld 2 code, seems to be throwing an NPE instead of using the InjectionPoint that I am providing the BeanManager with.</p>

<p style='margin-top:0;margin-bottom:10px;'>This can be reproduced right now by checking out the forge core repository branch 2.0. Just run, mvn clean install.</p>

<p style='margin-top:0;margin-bottom:10px;'><a href="https://github.com/forge/core/tree/2.0" class="external-link">https://github.com/forge/core/tree/2.0</a></p>

<p style='margin-top:0;margin-bottom:10px;'>The crux of the matter, we have a producer method in a CDI instance A:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
@Produces
<span class="code-keyword">public</span> <span class="code-keyword">static</span> Coverter&lt;?,?&gt; produceRemoteConverter(AddonRegistry registry, InjectionPoint ip)</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'>There are, however, no injection points actually consuming this type/producer method from within CDI instance A. (And adding one would not really help.)</p>

<p style='margin-top:0;margin-bottom:10px;'>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:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">Bean&lt;R&gt; bean = (Bean&lt;R&gt;) manager.resolve(manager.getBeans(type));
context = manager.createCreationalContext(bean);
<span class="code-object">Object</span> delegate = manager.getInjectableReference(injectionPoint, context);</pre>
</div></div>

<p style='margin-top:0;margin-bottom:10px;'>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.)</p>

<p style='margin-top:0;margin-bottom:10px;'>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.</p>

<p style='margin-top:0;margin-bottom:10px;'>I think this is a bug, since InjectionPoint is an interface, (but obviously very edge case if so.)</p>

<p style='margin-top:0;margin-bottom:10px;'>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.)</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">Caused by: java.lang.NullPointerException
    at org.jboss.weld.serialization.InjectionPointHolder.&lt;init&gt;(InjectionPointHolder.java:48)
    at org.jboss.weld.util.bean.SerializableForwardingInjectionPoint.&lt;init&gt;(SerializableForwardingInjectionPoint.java:33)
    at org.jboss.weld.bean.builtin.InjectionPointBean.newInstance(InjectionPointBean.java:51)
    at org.jboss.weld.bean.builtin.InjectionPointBean.newInstance(InjectionPointBean.java:31)
    at org.jboss.weld.bean.builtin.AbstractDecorableBuiltInBean.create(AbstractDecorableBuiltInBean.java:62)
    at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:701)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:768)
    at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:786)
    at org.jboss.weld.injection.ParameterInjectionPointImpl.getValueToInject(ParameterInjectionPointImpl.java:71)
    at org.jboss.weld.injection.MethodInjectionPoint.getParameterValues(MethodInjectionPoint.java:140)
    at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:79)
    at org.jboss.weld.injection.producer.ProducerMethodProducer.produce(ProducerMethodProducer.java:92)
    at org.jboss.weld.injection.producer.AbstractMemberProducer.produce(AbstractMemberProducer.java:188)
    at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:190)
    at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:701)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:729)
    at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:60)
    at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:67)
    at org.jboss.forge.container.impl.RemoteInstanceImpl$1.call(RemoteInstanceImpl.java:47)
    at org.jboss.forge.container.util.ClassLoaders.executeIn(ClassLoaders.java:34)
    ... 93 more</pre>
</div></div>
    </td>
</tr>
                                                                                                <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Project:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
        <a style="color:#326ca6;" href="https://issues.jboss.org/browse/WELD">Weld</a>
    </td>
</tr>                                                <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Priority:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                <img src="https://issues.jboss.org/images/icons/priority_major.gif" height="16" width="16" border="0" align="absmiddle" alt="Major">        Major
    </td>
</tr>                        <tr valign="top">
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 10px 10px 0;white-space:nowrap;">
        <strong style="font-weight:normal;color:#505050;">Reporter:</strong>
    </td>
    <td style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 10px 0;width:100%;">
                                        <a class="user-hover" rel="lincolnthree" id="email_lincolnthree" href="https://issues.jboss.org/secure/ViewProfile.jspa?name=lincolnthree" style="color:#326ca6;">Lincoln Baxter III</a>
                </td>
</tr>                                                    
    
    
                        </table>
                </td>
            </tr>
        </table>
    </td>
</tr>













            </table>
        </td><!-- End #email-page -->
    </tr>
    <tr valign="top">
        <td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:10px;line-height:14px;padding: 0 16px 16px 16px;text-align:center;">
            This message is automatically generated by JIRA.<br />
            If you think it was sent incorrectly, please contact your JIRA administrators<br />
            For more information on JIRA, see: <a style='color:#326ca6;' href='http://www.atlassian.com/software/jira'>http://www.atlassian.com/software/jira</a>
        </td>
    </tr>
</table><!-- End #email-wrap -->
</div><!-- End #email-body -->