[cdi-dev] [Vote] for CDI-527 / PR 271 allow proxying of classes with non-private final methods

Mark Struberg struberg at yahoo.de
Mon Feb 15 06:08:49 EST 2016


> Am 15.02.2016 um 09:29 schrieb Martin Kouba <mkouba at redhat.com>:
> 
> Do you mean to simply ignore the method? If we do (the current 
> non-portable solution of OWB and Weld) a user might be suprised why a 
> method invoked on a proxy does not reach the target instance (it will be 
> invoked upon a client proxy instance). Miserable default behavior I 
> believe. And this will happen for a client proxy for non-interface bean 
> types.

Technically that is afaik the only possible option we do have as long as we don’t rewrite the bytecode of the _original_ class. And that might be pretty hard to do for classes coming from the JDK for example ;)


As Jens perfectly nailed it:
a.) The user explicitly declares „Yes, I know what I do and I’ll live with the consequences“ and 
b.) Those are most times protected or package-default methods.

I think this will mostly happen with self-injection. And this will only happen to be a problem for CDI and NIV (as in ‚classic‘ EJBs you only can call ‚business methods‘ even for self injection. And business methods are always only public methods).
Of course that is an important use case, which you really need from time to time. But how often does ‚Random Jo/anna‘ programmer use this? In my experience there is a balance of 1:10000 self-injection methods vs general CDI method. 
It’s mostly used by experts who know what they do. 

LieGrue,
strub


More information about the cdi-dev mailing list