Re: What's the precise definition of an "Internal Name"
[email protected] Sat, 2 Jun 2018 07:59:45 +0200 (CEST)
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <1031627793.1083465329.1527919185203.JavaMail.root@zimbra73-e12.priv.proxad.net> |
1.a is the internal name, 1.b the descriptor. 2.a is both the internal name and the descriptor. The form 2.b is not used in .class files. See https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-4.html#jvms-4.4.1: "for such array classes, the name of the class is the descriptor of the array type" where "name" refers to the "name encoded in internal form" (from the "name_index" description). > Hi, > > > Sorry for bothering about this tiny matter, but answering these > question would clear my queries: > > > 1. which of these is the correct 'internal name' and which one is the > correct 'type descriptor' for 'Object': > > > a. java/lang/Object > b. Ljava/lang/Object; > > > > > 2. which of these is the correct 'internal name' and which one is the > correct 'type descriptor' for an array of 'Object's: > > > a. [Ljava/lang/Object; > b. java/lang/Object[] > > > > On Tue, May 22, 2018 at 8:34 PM Sagar Tewari < [email protected] > > wrote: > > > > 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 . The table on this 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 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 . 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 > > > > -- > > > > 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 > -- 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