Hello; it's me again, deep/close reading ProxyFactory.java to understand everything I can about proxies in Weld.

I think the proxy name produced by getProxyName() is based on the (quite possibly indeterminate) ordering of the Set of types that happens to be passed to it.  This would mean that even subsequent calls to this method with the same Set might yield different and surprising results.  Is this correct?

For example, in a test that I wrote to further understand how proxy names are constructed:

final Method getProxyName = ProxyFactory.class.getDeclaredMethod("getProxyName", String.class, Class.class, Set.class, Bean.class);
getProxyName.setAccessible(true);
final Set<Type> typeSet = new LinkedHashSet<>();
// Let's add two disparate interfaces in an arbitrary, but predictable, order.
typeSet.add(Serializable.class);
typeSet.add(Cloneable.class);
final String proxyName = (String)getProxyName.invoke(null, null, Object.class, typeSet, null);
assertEquals("java.io.Cloneable$Serializable$$Proxy$", proxyName); // ?!  Whoa.  Not what I expected.

proxyName contains "java.io.Cloneable$Serializable$$Proxy$".  Is that by design?  Or is the "java.io.Cloneable" part a mistake?

And are the double dollar signs ($$) in this case intentional as well?  (There are certainly paths through this method that won't result in double dollar signs, so I'm not sure if this is a bug or a feature.)  To my eyes, this is suspicious: https://github.com/weld/core/blob/10a1d11af8c815a2a4a8fc5a4061698215e602b0/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java#L283  Shouldn't that happen only if there aren't any more interface names to add?  So are the two dollar signs just a symptom of a bug?

By contrast, in case it matters, my naïve expectation, following what seems to me the intended logic of the method, would have been for proxyName to contain "java.lang.Cloneable$Serializable$Proxy$".

Best,
Laird