java.lang.constant.ClassDesc and TypeDescriptor for hidden class??

John Rose john.r.rose at oracle.com
Thu Apr 2 00:38:44 UTC 2020


Thanks for catching this.  Brian will probably observe that
the ClassDesc is not enough to recover the class, since it needs
a ClassLoader also.  A class whose CL is hard to deduce might
be called an “elusive class”.  The practical difference between
a hidden class and an elusive class is that hidden classes are
completely elusive:  You cannot find a CL that will produce
one.  Treating the Constable API differently in these cases
amounts to differentiating between “partially elusive or
well known” vs. “completely elusive” (aka hidden). 

This kind of argues me into the position that there’s not
a big advantage (and perhaps some disadvantage) to
error-checking the constable description of a HC.

Thus, I think I prefer the regularity which lumps
HCs with other elusive classes, with this option:

> c) returns `La/b/C.0x1234;`

This bit is slightly surprising to me:

> <suffix> is an unqualified name that is guaranteed to be unique during this execution of the JVM

It started out as an identity hash code, so it was usually but not guaranteed
unique.  Is there a cost to this guarantee?  Do we just have a 64-bit atomic
counter? What if that overflows?  I would prefer not to guarantee uniqueness
because that’s extra work and it tempts users to misuse it (as a secret
namespace).

— John


More information about the valhalla-dev mailing list