<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Lincoln,<br>
      <br>
      can you provide a stack trace? I tried reproducing as described
      but I only see a NPE being thrown from Maven so I assume I am
      observing something else. What you do should work. Please file a
      Weld issue.<br>
      <br>
      Btw, is there a reason why you need to "fake" the InjectionPoint?.
      Since you have a Bean object and a CreationalContext object
      available in your code you can obtain a contextual reference using
      the BeanManager.getReference() method without faking the IP.<br>
      <br>
      JH<br>
      <br>
      On 01/11/2013 11:27 PM, Lincoln Baxter, III wrote:<br>
    </div>
    <blockquote
cite="mid:CAEp_U4GMuzvA7TYnaThzGnqhAwgrSAZ1viSMxkdL3-dmQodk+A@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>Hey all,<br>
              <br>
            </div>
            I have a problem with "Faking an injection point," 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 moz-do-not-send="true"
            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 moz-do-not-send="true" href="http://ocpsoft.org"
                  target="_blank">http://ocpsoft.org</a><br>
                "Simpler is better."
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>