Integrated: 7904028: jcstress: Address s.m.Unsafe use warnings which fail build on JDK 23+

Pavel Rappo prappo at openjdk.org
Thu Jun 19 09:53:43 UTC 2025


On Sun, 8 Jun 2025 22:22:37 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

> Here I propose a simple, symptomatic solution to fix build failures on JDK 23+ caused by treating "deprecated for removal" warnings as errors.
> 
> In the patch, I tried to keep the scope of `@SuppressWarnings` to a minimum. However, in a few cases I had to broaden it. This is because this annotation cannot be applied to a static initializer or an assignment within it.
> 
> Instead of extracting code into methods for the sake of annotating those, I annotated the smallest annotatable outer element, which was the top-level class. For example, see: `UnsafeBusyLoopTest`, `UnsafeAddLong1`, `UnsafeAddLong42`. 
> 
> I note that in JBS @shipilev suggested another approach to address the warnings. Namely, to move from `Unsafe` to `VarHandle`. However, such an approach is beyond my competence. And if chosen, it should be done by someone else. Thanks.

This pull request has now been integrated.

Changeset: 8563b0cd
Author:    Pavel Rappo <prappo at openjdk.org>
Committer: Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.org/jcstress/commit/8563b0cdfc14bfd5b8f231ad241869039d3af32f
Stats:     18 lines in 8 files changed: 18 ins; 0 del; 0 mod

7904028: jcstress: Address s.m.Unsafe use warnings which fail build on JDK 23+

Reviewed-by: shade

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

PR: https://git.openjdk.org/jcstress/pull/165


More information about the jcstress-dev mailing list