[lworld] RFR: 8376045: [lworld] Treat @NullRestricted fields as ACC_STRICT_INIT on load

Dan Smith dlsmith at openjdk.org
Fri Jan 23 23:04:56 UTC 2026


On Thu, 22 Jan 2026 21:40:30 GMT, Chen Liang <liach at openjdk.org> wrote:

> Automatically inject strict for NR annotations, and remove tests that previously kept them separate.

My worry is that if the annotation gets ignored in a non-preview class file, we'll have to be sure javac is setting the preview version number for the relevant tests. But Chen is right, I think, that a value-class-typed field should already trigger LoadableDescriptors and a preview version number, so maybe there's nothing to worry about here.

Alternatively, we can interpret the annotation in all class file versions. That's what I thought we wanted, and I was just confirming that nothing later is going to break because of an unexpected version number. Sounds like probably not.

So it seems good either way.

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

PR Comment: https://git.openjdk.org/valhalla/pull/1951#issuecomment-3792944703


More information about the valhalla-dev mailing list