On Mon, 4 May 2026 12:25:02 GMT, Paul Hübner <[email protected]> wrote:
>> Hi all, >> >> This skips the test `TestFieldNullMarkers.java` when `-XX:-PreloadClasses` >> is specified. >> >> According to [JDK-8380053](https://bugs.openjdk.org/browse/JDK-8380053), the >> semantics of `@NullRestricted` are as follows: >>> The proposed new interpretation of the @NullRestricted annotation is as >>> follows: >>> - if the type of the field has been loaded during the preloading process >>> and is a concrete value class, then the @NullRestricted semantic is >>> applied to the field >>> - if the type of the field cannot / has not been loaded during the >>> preloading process, or the loaded type is not a concrete value class, then >>> the annotation is ignored >> >> Since `-PreloadClasses` is specified, when the test is loaded, the classes >> of its `@NullRestricted` fields are not loaded. Therefore, these fields >> cannot be treated as null-restricted in accordance to the above semantics. >> Consequently, the test is throwing `java.lang.RuntimeException: No NPE >> thrown` because the VM permits a null-write to what it considers a regular >> field. >> >> This was not noticed until >> [JDK-8383242](https://bugs.openjdk.org/browse/JDK-8383242) was integrated, >> as the semantics were not applied in the VM due to a bug this CR fixed. >> >> Testing: tier 1, running this test locally with all constellations of the >> flag, and Oracle-internal tests. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Paul Hübner has updated the pull request incrementally with one additional > commit since the last revision: > > Skip a few more tests. Looks good to me. Thanks for fixing! ❤️ ------------- Marked as reviewed by thartmann (Committer). PR Review: https://git.openjdk.org/valhalla/pull/2379#pullrequestreview-4220045267
