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

Remi Forax <[email protected]> Tue, 22 May 2018 11:38:46 +0200 (CEST)
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
> 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 

> [
> https://gitlab.ow2.org/asm/asm/blob/master/asm/src/test/java/org/objectweb/asm/TypeTest.java#L297
> | This ] 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 [
> https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-4.html#jvms-4.2.1 |
> jvm specs ] . 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 |
> 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