java.lang.constant.ClassDesc and TypeDescriptor for hidden class??
Peter Levart
peter.levart at gmail.com
Tue Apr 14 10:00:49 UTC 2020
On 4/13/20 10:18 PM, Mandy Chung wrote:
> Another consideration:
> The name of an array class with a hidden class as its element type.
>
> Option c -
> `Class::getName` returns "[Lfoo.Foo/123Z;" and
> `Class::descriptorString` returns "[Lfoo/Foo.123Z;"
>
> The name of array class for `HC[]` is "[" + "L" + <HC's name> + ";"
> The descriptor of array class for `HC[]` is "[" + <HC's descriptor>
See, higher-level descriptors still work.
>
> Option c' - what should `Class::getName` return?
> (i) `Class::getName` "[Lfoo.Foo/123Z;" and `Class::descriptorString`
> returns "[Lfoo/Foo;/123Z"
>
> The name of array class for `HC[]` is "[" + "L" + <HC's name> + ";"
> The descriptor of array class for `HC[]` is "[" + <HC's descriptor>
>
> It is not trivially obvious to tell from the resulting name and
> descriptor string represent the same array class of HC[].
> (ii) `Class::getName` "[Lfoo.Foo;/123Z" and `Class::descriptorString`
> returns "[Lfoo/Foo;/123Z"
>
> "foo.Foo/123Z" is HC's class name and "[Lfoo.Foo;/123Z" isn't quite
> right to be the name of array class of HC. (i) is less awful.
Another irregularity. How would one go from binary name to descriptor or
back? Logic becomes complicated.
Peter
>
> Mandy
More information about the valhalla-dev
mailing list