> 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. ------------- Changes: - all: https://git.openjdk.org/valhalla/pull/2379/files - new: https://git.openjdk.org/valhalla/pull/2379/files/b860e5de..6d17fbf0 Webrevs: - full: https://webrevs.openjdk.org/?repo=valhalla&pr=2379&range=01 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=2379&range=00-01 Stats: 11 lines in 3 files changed: 11 ins; 0 del; 0 mod Patch: https://git.openjdk.org/valhalla/pull/2379.diff Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2379/head:pull/2379 PR: https://git.openjdk.org/valhalla/pull/2379
