Re: What's the precise definition of an "Internal Name"
Sagar Tewari <[email protected]> Sat, 2 Jun 2018 09:43:12 +0530
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <CAJ8WsYNkxox5fN323uRZ7QFugCysiZpKmamnUcTNk_aUH3BPcg@mail.gmail.com> |
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 > <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 > -- 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