Migrating library classes to value classes

forax at univ-mlv.fr forax at univ-mlv.fr
Mon Mar 4 23:22:05 UTC 2024


> From: "Kevin Bourrillion" <kevinb9n at gmail.com>
> To: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "valhalla-spec-experts" <valhalla-spec-experts at openjdk.org>
> Sent: Monday, March 4, 2024 11:57:20 PM
> Subject: Re: Migrating library classes to value classes

> On Mon, Mar 4, 2024 at 2:44 PM Remi Forax < [ mailto:forax at univ-mlv.fr |
> forax at univ-mlv.fr ] > wrote:

>> For a class that you want to see both as an identity class and a value class,
>> either you use Maven or Gradle (see [1]) but you have to hand manage the
>> different versions or you use a special bytecode rewriter that look for
>> annotations internal to your project and duplicate the classes (it seems a good
>> use case for the classfile API) with one version being an identity class and
>> one version being a value classes.

> And don't forget the testing impact.

Yes, you need to rewite *before* testing :) 
[ https://github.com/forax/civilizer/blob/master/pom.xml#L69 | https://github.com/forax/civilizer/blob/master/pom.xml#L69 ] 

> I view this as not a good solution, and think that approaches that don't require
> users to rig up such machinery on their side are worth finding when possible.

Having two classes for any value classes is also what the JDK does for all @ValueBased classes. 
The other solution is to backport behavior of the new VMs to the old ones but this is similar to Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn. 

Rémi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-spec-experts/attachments/20240305/ed593b4c/attachment-0001.htm>


More information about the valhalla-spec-experts mailing list