inline record ref projection contains an empty record attribute

forax at univ-mlv.fr forax at univ-mlv.fr
Mon Dec 7 17:13:22 UTC 2020


----- Mail original -----
> De: "Chris Hegarty" <chris.hegarty at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "Srikanth" <srikanth.adayapalam at oracle.com>, "Jim Laskey" <james.laskey at oracle.com>, "valhalla-dev"
> <valhalla-dev at openjdk.java.net>
> Envoyé: Lundi 7 Décembre 2020 17:56:58
> Objet: Re: inline record ref projection contains an empty record attribute

> Remi,
> 
>> On 7 Dec 2020, at 16:25, Remi Forax <forax at univ-mlv.fr> wrote:
>> 
>> ----- 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
> 
> I do not have a reference to hand, but the requirement for Class::isRecord to
> check that j.l.Record is a the direct superclass was requested during one of
> the umbrella records CSRs. There was a concern that the reflective APIs could
> be “fooled” into thinking that a particular j.l.Class is a record class when it
> is in fact largely not in a record class, as outlined by the JLS.

Checking the direct super class is fine now, until we have inline record, because for an inline record, j.l.Record is not the direct superclass.
I suppose the question is should the record reflection spec be changed now or later when Valhalla is ready.
My guess is that we have same issue with java.lang.Enum if you want an inline enum, j.l.Enum can be the 3rd superclass,
so it's may be better to change that as part of Valhalla and not as part of Amber.

> 
>> instead of isAssignableFrom (or mark all classes that inherits directly or
>> indirectly from java.lang.Record if perf is an issue).
> 
> If isAssignableFrom is sufficient ( now that isRecord asserts finalness ), then
> maybe both the JLS and reflection should be updated. It might be best to bring
> this up on the Amber list.

I did, on valhalla list and not amber list.

> 
> -Chris.

Rémi


More information about the valhalla-dev mailing list