[
https://issues.apache.org/jira/browse/OWB-231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12866737#action_12866737
]
Joe Bergmark commented on OWB-231:
----------------------------------
I was taking a look at this again and noticed an interesting side affect.
If the Decorator itself is normal scoped (which is non-portable behavior, and
not recommended), then this doesn't blow up. I believe that is because when we
create the instance of the Decorator we actually get back a proxy which fully
implements the interface (and isn't abstract). Later in
DelegateHandler.invoke, if the method exists in the abstract class it gets
called on the proxy and works.
If I'm right, then perhaps a simple solution would be to create a proxy class
during the call to WebBeansDecorator.createInstance() if the Decorator is
Abstract. I'll give this a shot in the next couple of days and see if it
solves the problem.
> 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: Gurkan Erdogdu
> 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.