[ 
https://issues.apache.org/jira/browse/OWB-714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13611750#comment-13611750
 ] 

Jonathan S Fisher commented on OWB-714:
---------------------------------------

Experiencing the same problem. I'm fairly certain Instance<> was designed to 
work transparently. Take a look:

An InjectionPoint object provides metadata information about an injection 
point. An instance of InjectionPoint may represent one of the following types:

* an injected field
* a parameter of a bean constructor
* an initializer method
* a producer method
* a disposer method
* an observer method

I would propose one of the purposes of Instance<> class was to allow for 
non-serializable objects to be proxied and injected into serializable beans. 
While the spec isn't specific, I'm having a hard time imaging a use case where 
a developer would want to get ahold of the Instance proxy instead of the 
proxied object. I would argue the Instance<> class was designed to be 
transparent.
                
> EmptyStackException when accessing an instance that is created by a producer 
> method that has an InjectionPoint as parameter.
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OWB-714
>                 URL: https://issues.apache.org/jira/browse/OWB-714
>             Project: OpenWebBeans
>          Issue Type: Bug
>            Reporter: Arne Limburg
>            Assignee: Arne Limburg
>
> EmptyStackException when accessing an Instance that is created by a producer 
> method that has an InjectionPoint as parameter.
> The following code leads to the exception:
> public class MyProducingBean {
>     @Produces
>     public MyProducedBean produceBean(InjectionPoint ip) {
>         ...
>     }
> }
> public class MyUsingBean {
>     @Inject
>     private Instance<MyProducedBean> beanInstance;
>     public void someMethod() {
>         beanInstance.get(); // throws EmptyStackException
>     }
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to