[lworld] RFR: 8331606: [lworld] javac should consider some library classes as value classes [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu May 9 10:23:06 UTC 2024


On Thu, 9 May 2024 02:15:38 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> For some library classes two compiled versions are produced, one is the legacy class file and the other one is a class file representing a value class. The version representing a value class is stored in a separate jar. During compilation of classes using one of these library classes javac loads the vanilla version. But if preview features are enabled, javac should act as if the loaded class was the one representing the value class. So basically javac's class loader needs to massage the flags in the loaded class so that the rest of the compiler pipeline can handle it as a value class. This PR is proposing an annotation to mark these classes so that they can be identified by javac without having to keep an internal list of classes that will need to be maintained,
>> 
>> TIA
>
> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
> 
>   minor refactorings

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java line 3180:

> 3178:         if (((flags & ACC_IDENTITY) != 0 && !isMigratedValueClass(flags)) || (majorVersion < V66.major && (flags & INTERFACE) == 0)) {
> 3179:             flags |= IDENTITY_TYPE;
> 3180:         } else if (needsValueFlag(c, flags)) {

isn't this redundant? E.g. isn't VALUE_CLASS set as soon as you see the annotation?

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/1104#discussion_r1595263866



More information about the valhalla-dev mailing list