On Tue, 14 Jul 2026 22:12:18 GMT, Chen Liang <[email protected]> wrote:

> We should mark record classes as using preview VM features if they use 
> strictly-initialized fields or early larval frames.
> 
> Maurizio considered this to be P2 given the spec violations, especially with 
> the spurious early larval frames in the class files.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 1159:

> 1157:                 if (allowValueClasses && (isInstanceFieldOfValueClass 
> || isRecordField)) {
> 1158:                     implicit |= FINAL | STRICT;
> 1159:                     preview.markUsesPreview(pos); // STRICT_INIT is a 
> preview VM feature

Ok -- this also means that if a record has no component, no pollution occurs, 
which I suppose it's ok.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2643#discussion_r3585815776

Reply via email to