Re: What's the precise definition of an "Internal Name"

Sagar Tewari <[email protected]> Tue, 22 May 2018 20:34:18 +0530
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <CAJ8WsYM+TxwpMVgPwOgJG5V5BUKhs_s90MrwFjHkE-_oktqsNA@mail.gmail.com>
The Type.getInternalName Method replaces dots with slashes in the output of
Class.getName. It looks like the result of that would be a Field Descriptor
<https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-4.html#jvms-4.3.2>.
The table on this
<https://checkerframework.org/manual/#signature-checker> page,
below the hierarchy diagram supports that.

So does it mean that wherever the ASM library asks for an internal name to
be passed, it actually expects a Field Descriptor (as defined by the jvm
specs)?

On Tue, May 22, 2018 at 3:10 PM Remi Forax <[email protected]> wrote:

>
>
> ------------------------------
>
> *De: *"Sagar Tewari" <[email protected]>
> *À: *"asm" <[email protected]>
> *Envoyé: *Mardi 22 Mai 2018 09:05:51
> *Objet: *[asm] What's the precise definition of an "Internal Name"
>
> Hi,
>
>
> Hi
>
>
> This
> <https://gitlab.ow2.org/asm/asm/blob/master/asm/src/test/java/org/objectweb/asm/TypeTest.java#L297> test
> compares the output of 'Type.getInternalName(Object[].class)' to the
> string "[Ljava/lang/Object;", which *is not an internal name *as
> specified by the jvm specs
> <https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-4.html#jvms-4.2.1>.
> The correct internal name of 'Object[]' should be 'java/lang/Object[]', as
> it's binary name is 'java.lang.Object[]'(
> https://docs.oracle.com/javase/specs/jls/se10/html/jls-13.html#jls-13.1),
> and the internal name equals binary name with '.'s replaced with '/'s. The
> implementation of this method just replaces '.'s with '/'s in the output of
> 'Class.getName'.
>
>
> I've always though that the section 4.1 was confusing, i believe it's
> because historically, prior to 1.5 i think, you were not able to use an
> array as an internal name, now you can do a ldc on an array or an
> invokevirtual clone().
>
> The section 5.1 is more precise of what is an internal name of an array
>   https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-5.html#jvms-5.1
>
>
> I suspect the reason to be difference in terminology used. Would
> appreciate if anyone could clarify the situation. Also, the method isn't
> used anywhere outside of tests.
>
>
> Type is a helper class, the ASM visitors API uses String to encode
> internal name (you can search for internal name on a ClassVisitor, a
> MethodVisitor, etc.
>
>
>
> --
> Best Regards
> Sagar Tewari
>
>
> regards,
> Rémi
>
>
> --
> You receive this message as a subscriber of the [email protected] mailing list.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


-- 
Best Regards
Sagar Tewari


-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws