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

Joe Bergmark commented on OWB-231:
----------------------------------

Unfortunately this turns out to be a bit more complicated than I had originally 
hoped.

WebBeansDecorator.createInstance calls down into Context.get to create an 
instance of the Decorator.  Eventually that bubbles down into 
ManagedBean.createComponentInstance().  From inside ManagedBean we don't know 
that this bean we are trying to create is a Decorator.

It does appear that we can query the the "returnType" from the super class 
(AbstractOwbBean) and determine that the class is abstract 
(returnType.getModifiers()).

I'm just not sure where the right place is to create the proxy.  Is there 
anything (other than supporting Abstract) that differentiates Decorators from 
normal ManagedBeans?  Would it make sense to add a new type?

> exception using abstract decorators
> -----------------------------------
>
>                 Key: OWB-231
>                 URL: https://issues.apache.org/jira/browse/OWB-231
>             Project: OpenWebBeans
>          Issue Type: Bug
>          Components: Interceptor and Decorators
>    Affects Versions: M3
>            Reporter: Eric Covener
>            Assignee: Joe Bergmark
>             Fix For: 1.0.0
>
>   Original Estimate: 3h
>  Remaining Estimate: 3h
>
> After r897450, abstract decorator classes are passed to 
> Constructor.newInstance() and cause an exception:
> Caused by: java.lang.InstantiationException
>       at 
> sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
>       at java.lang.reflect.Constructor.newInstance(Constructor.java:515)
>       at 
> org.apache.webbeans.inject.InjectableConstructor.doInjection(InjectableConstructor.java:87)
>       at 
> org.apache.webbeans.component.ManagedBean.createComponentInstance(ManagedBean.java:61)
>       at 
> org.apache.webbeans.component.AbstractInjectionTargetBean.createDefaultInstance(AbstractInjectionTargetBean.java:128)
>       at 
> org.apache.webbeans.component.AbstractInjectionTargetBean.createInstance(AbstractInjectionTargetBean.java:112)
>       at 
> org.apache.webbeans.component.AbstractBean.create(AbstractBean.java:159)
>       at 
> org.apache.webbeans.context.DependentContext.getInstance(DependentContext.java:66)
>       at 
> org.apache.webbeans.context.AbstractContext.get(AbstractContext.java:150)
>       at 
> org.apache.webbeans.decorator.WebBeansDecorator.createInstance(WebBeansDecorator.java:244)
>       at 
> org.apache.webbeans.component.AbstractBean.create(AbstractBean.java:159)
>       ... 33 more
> If you take Joe Bergmark's testcase from OWB-151, and make the bean 
> @RequestScoped and the decorator abstract, you can generate the same 
> backtrace.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to