java.lang.constant.ClassDesc and TypeDescriptor for hidden class??
john.r.rose at oracle.com
Wed Apr 8 22:31:35 UTC 2020
On Apr 8, 2020, at 2:46 PM, Mandy Chung <mandy.chung at oracle.com> wrote:
> Option c: `Lfoo/Bar.123Z;`
> Option c': `Lfoo/Bar;/123Z`
I’m OK with either; both satisfy the proposed dual-use criterion.
I put forward c’ because it seems slightly easier to specify, and
because, choosing between the two options, the sort of error
that might happen seems to be slightly friendlier in the case
of c’. “Slightly” in both cases.
In the case of c an error could happen if the user blindly mapped
slash to dot after stripping the L; envelope. (I hear they do these
sorts of things.) In that case, the illegality of the HC would be
lost, replacing it by foo/Bar/123Z, which the JVM thinks is just
In the case of c’ an error could happen if the user blindly takes
everything up to the semicolon, again replacing foo/Bar.123Z
by foo/Bar which again looks good to both the JVM and the
In both c and c’ there will probably be a cascading failure
if the name foo/Bar/123Z or foo/Bar is resolved. In c’ there
is an additional cascading failure when the user that was
parsing the signature goes back for more parameters and
finds a slash (instead of LZBHCIJFD[). The thing that tipped
me over to c’ is that extra diagnostic: Even though it happens
after the user picked up the bad descriptor, it happens closer
to the place where the error has its root cause, which is that
somebody is trying to parse an (intentionally) illegal descriptor.
More information about the valhalla-dev