inline record ref projection contains an empty record attribute

Remi Forax forax at univ-mlv.fr
Mon Dec 7 16:25:36 UTC 2020


----- Mail original -----
> De: "Srikanth" <srikanth.adayapalam at oracle.com>
> À: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Cc: "Jim Laskey" <james.laskey at oracle.com>
> Envoyé: Lundi 7 Décembre 2020 08:27:39
> Objet: Re: inline record ref projection contains an empty record attribute

> Hi Remi,

Hi Srikanth, hi Jim,

> 
> Thanks for the problem report.
> https://bugs.openjdk.java.net/browse/JDK-8251041 tracks the issues
> relating to inline records.
> We know of quite a few issues. (including reported by you in the past) -
> Jim is looking into these.

my main blocking point actually is that the reflection API checks if a class is a record using getSuperclass() == j.l.Record.class instead of isAssignableFrom (or mark all classes that inherits directly or indirectly from java.lang.Record if perf is an issue).

> 
> Srikanth

Rémi

> 
> On 02/12/20 5:48 pm, Remi Forax wrote:
>> Hi all,
>> using this inline record
>>
>> public @__inline__ record IntBox(int value) {}
>>
>> When the compiler generates the ref projection, IntBox$Ref, an empty attribute
>> "Record" is generated which i believe is a mistake.
>> The ref projection should not contains that attribute at all.
>>
>> regards,
>> Rémi
>>
>> ---
>> Classfile
>> /home/forax/git/transmogrif/target/classes/fr/umlv/transmogrif/IntBox$ref.class
>>    Last modified Dec 2, 2020; size 222 bytes
>>    SHA-256 checksum
>>    2ee826fe2e8735044ea2a7f9e766aa101a7786385b5d27291864e7e4d550d6e2
>>    Compiled from "IntBox.java"
>> public abstract class fr.umlv.transmogrif.IntBox$ref extends java.lang.Record
>>    minor version: 0
>>    major version: 60
>>    flags: (0x0421) ACC_PUBLIC, ACC_SUPER, ACC_ABSTRACT
>>    this_class: #1                          // fr/umlv/transmogrif/IntBox$ref
>>    super_class: #3                         // java/lang/Record
>>    interfaces: 0, fields: 0, methods: 0, attributes: 4
>> Constant pool:
>>     #1 = Class              #2             // fr/umlv/transmogrif/IntBox$ref
>>     #2 = Utf8               fr/umlv/transmogrif/IntBox$ref
>>     #3 = Class              #4             // java/lang/Record
>>     #4 = Utf8               java/lang/Record
>>     #5 = Utf8               SourceFile
>>     #6 = Utf8               IntBox.java
>>     #7 = Utf8               NestMembers
>>     #8 = Class              #9             // fr/umlv/transmogrif/IntBox
>>     #9 = Utf8               fr/umlv/transmogrif/IntBox
>>    #10 = Utf8               Record
>>    <------------ oops
>>    #11 = Utf8               PermittedSubclasses
>> {
>> }
>> SourceFile: "IntBox.java"
>> NestMembers:
>>    fr/umlv/transmogrif/IntBox
>> PermittedSubclasses:
>>    fr/umlv/transmogrif/IntBox
>> Record:
>> [forax at localhost transmogrif]$ javap -private -c -verbose
>> target/classes/fr/umlv/transmogrif/IntBox\$ref.class
>> Classfile
>> /home/forax/git/transmogrif/target/classes/fr/umlv/transmogrif/IntBox$ref.class
>>    Last modified Dec 2, 2020; size 222 bytes
>>    SHA-256 checksum
>>    2ee826fe2e8735044ea2a7f9e766aa101a7786385b5d27291864e7e4d550d6e2
>>    Compiled from "IntBox.java"
>> public abstract class fr.umlv.transmogrif.IntBox$ref extends java.lang.Record
>>    minor version: 0
>>    major version: 60
>>    flags: (0x0421) ACC_PUBLIC, ACC_SUPER, ACC_ABSTRACT
>>    this_class: #1                          // fr/umlv/transmogrif/IntBox$ref
>>    super_class: #3                         // java/lang/Record
>>    interfaces: 0, fields: 0, methods: 0, attributes: 4
>> Constant pool:
>>     #1 = Class              #2             // fr/umlv/transmogrif/IntBox$ref
>>     #2 = Utf8               fr/umlv/transmogrif/IntBox$ref
>>     #3 = Class              #4             // java/lang/Record
>>     #4 = Utf8               java/lang/Record
>>     #5 = Utf8               SourceFile
>>     #6 = Utf8               IntBox.java
>>     #7 = Utf8               NestMembers
>>     #8 = Class              #9             // fr/umlv/transmogrif/IntBox
>>     #9 = Utf8               fr/umlv/transmogrif/IntBox
>>    #10 = Utf8               Record
>>    #11 = Utf8               PermittedSubclasses
>> {
>> }
>> SourceFile: "IntBox.java"
>> NestMembers:
>>    fr/umlv/transmogrif/IntBox
>> PermittedSubclasses:
>>    fr/umlv/transmogrif/IntBox
>> Record:                                 <------------------------ oops



More information about the valhalla-dev mailing list