[weld-dev] ProxyFactory#getProxyName() question

Matej Novotny manovotn at redhat.com
Wed Mar 11 04:28:05 EDT 2020


Thanks.

Few more comments.

> (Just a quick correction: org.jboss.weld.io.Cloneable$Serializable$$Proxy$_$$_Weld$Proxy$.)

The reason the package is changed is because Java forbids you to define new classes (even if you hack into CL) into any package starting with "java.*".
Hence we detect those and replace "java" with "org.jboss.weld". Apparently this also affects "javax" prefixes since "javax" contains "java" substring.
Not sure if this is intended or needed but it will soon vanish since we will live in a Jakarta world ;-)

The "getProxyName()" method returns what we would consider a working proxy name. The fact that we change the package later is due to java limitations.
It's true that it could probably reside in one method, but there is not much harm done in this I suppose.

Also notably, if you operate on proxies from classes in user applications, you will end up with much more "natural" proxy class names.
E.g. even without the sorting most beans have some sort of type closure that is several types deep but linear (as opposed to serializable and cloneable having nothing in common).
With that the proxy will look more sensibly. You also won't need to replace package names as any class coming from user app will be legit (of course they can still have producers on java.* types though).
Still, your example is a good one as it demonstrates the inconsistency that can happen :)

Matej

----- Original Message -----
> From: "Laird Nelson" <ljnelson at gmail.com>
> To: "Matej Novotny" <manovotn at redhat.com>
> Cc: weld-dev at lists.jboss.org
> Sent: Tuesday, March 10, 2020 11:45:42 PM
> Subject: Re: [weld-dev] ProxyFactory#getProxyName() question
> 
> On Tue, Mar 10, 2020 at 9:07 AM Matej Novotny <manovotn at redhat.com> wrote:
> 
> > If you want, go ahead and create a Weld issue so this doesn't get
> > forgotten again :)
> >
> 
> Done: https://issues.redhat.com/browse/WELD-2618
> 
> Best,
> Laird
> 


More information about the weld-dev mailing list