[weld-dev] Example project to show private observer failure with decorator

Matej Novotny manovotn at redhat.com
Fri Jun 10 01:26:57 EDT 2016


Hi,

thanks for your report and for the reproducer. We will take a look at it and get back to you soon.

As for WELD-2092, that cannot be the cause of this behaviour because it was added in Alpha15
and your reproducer breaks with Alpha14 already.

Matej


----- Original Message -----
> From: "Larry Streepy" <larry.streepy at raptorx.org>
> To: weld-dev at lists.jboss.org
> Sent: Friday, June 10, 2016 12:36:35 AM
> Subject: [weld-dev] Example project to show private observer failure with	decorator
> 
> 
> 
> The attached project (maven and intellij) exhibits the problem with private
> observer methods when an App scoped bean is decorated.
> 
> 
> 
> You can rung it from IJ, or from the command line using: mvn compile
> exec:java -Dexec.mainClass=Main
> 
> 
> 
> As delivered, you should see output like the following:
> 
> 
> 
> doSomething decorator,
> delegate=org.jboss.weld.proxies.AppScopeBean$Proxy$_$$_WeldSubclass at 4550bb58
> 
> doSomething,
> this=org.jboss.weld.proxies.AppScopeBean$Proxy$_$$_WeldSubclass at 4550bb58 ,
> anInt=5
> 
> Got event,
> this=org.jboss.weld.proxies.AppScopeBean$Proxy$_$$_Weld$Proxy$@49139829 <=
> should be org.jboss.weld.proxies.AppScopeBean$Proxy$_$$_WeldSubclass
> 
> Got event, anInt=0 <= should be 5
> 
> 
> 
> Note the “anInt=0” where it should be 5. If you change AppScopeBean#observer
> from ‘private’ to ‘protected’ you will see output like this:
> 
> 
> 
> doSomething decorator,
> delegate=org.jboss.weld.proxies.AppScopeBean$Proxy$_$$_WeldSubclass at 4550bb58
> 
> doSomething,
> this=org.jboss.weld.proxies.AppScopeBean$Proxy$_$$_WeldSubclass at 4550bb58 ,
> anInt=5
> 
> Got event,
> this=org.jboss.weld.proxies.AppScopeBean$Proxy$_$$_WeldSubclass at 4550bb58 <=
> should be org.jboss.weld.proxies.AppScopeBean$Proxy$_$$_WeldSubclass
> 
> Got event, anInt=5 <= should be 5
> 
> 
> 
> Note that in the latter case, the member variable is properly initialized.
> The problem stems from the fact that the proxy implementation doesn’t
> include the private methods. I think that the changes included in
> https://issues.jboss.org/browse/WELD-2092 have broken decorated beans with
> private observer methods. It also hinders tests that use things like JMockit
> Deencapsulation to invoke private methods on bean instances.
> 
> 
> 
> I don’t know how this all reconciles with the CDI spec, but the current
> implementation seems broken if I can’t have a private observer method simply
> because the class is the target of a Decorator.
> 
> 
> 
> Thanks for taking the time to review this post.
> 
> 
> 
> Larry.
> 
> 
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev



More information about the weld-dev mailing list