[lworld] Integrated: 8342575: [lworld] Compiler should reject volatile fields in value classes

Vicente Romero vromero at openjdk.org
Thu Nov 7 22:14:02 UTC 2024


On Thu, 7 Nov 2024 21:16:21 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> programs like:
> 
> 
> value class V {
>     volatile int f = 1;
> }
> 
> 
> should be rejected by javac as instance fields of value classes are implicitly final and according to the `JLS 23`, `8.3.1.4 volatile Fields`:
> 
> It is a compile-time error if a final variable is also declared volatile

This pull request has now been integrated.

Changeset: 37ddfeec
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.org/valhalla/commit/37ddfeeca7133c6f52b71b6fd78ebbe760ce735c
Stats:     14 lines in 3 files changed: 9 ins; 1 del; 4 mod

8342575: [lworld] Compiler should reject volatile fields in value classes

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

PR: https://git.openjdk.org/valhalla/pull/1297


More information about the valhalla-dev mailing list