JDK 14 record type representation in classfile format?
Vicente Romero
vicente.romero at oracle.com
Sat Mar 21 20:19:41 UTC 2020
I don't think that this is a bug. Records are using indy to invoke
bootstrap methods that implement: toString, equals and hashCode. The
first parameter of every bootstrap method is:
java/lang/invoke/MethodHandles$Lookup which is an inner class and thus
requires a dedicated InnerClasses attribute. You can reproduce a very
similar pattern with any code that uses bootstrap methods like:
class StringTest {
String m(String s) {
return s + "";
}
}
Thanks,
Vicente
On 3/21/20 4:01 PM, Remi Forax wrote:
> ----- Mail original -----
>> De: "Remi Forax" <forax at univ-mlv.fr>
>> À: "Luke Hutchison" <luke.hutch at gmail.com>
>> Cc: "jdk-dev" <jdk-dev at openjdk.java.net>, "amber-dev" <amber-dev at openjdk.java.net>
>> Envoyé: Samedi 21 Mars 2020 19:00:04
>> Objet: Re: JDK 14 record type representation in classfile format?
> [...]
>
>>> Also, records have an "InnerClasses" class attribute, with an inner class
>>> name of "java.lang.invoke.MethodHandles$Lookup" and an outer class name of
>>> "java.lang.invoke.MethodHandles". Normally the outer class name matches the
>>> class whose classfile the attribute is contained in. Why is this inner
>>> class attribute there, and why does the outer class name not match the name
>>> of the record?
>> This look like a bug to me.
> I've created https://bugs.openjdk.java.net/browse/JDK-8241398 to track that.
>
> cheers,
> Rémi
More information about the amber-dev
mailing list