Use AtomicReference#weakCompareAndSetPlain(T, T)

MSAL

Use AtomicReference#weakCompareAndSetPlain(T, T) instead of the deprecated AtomicReference#weakCompareAndSet(T, T) in Java 9 or higher.

org.openrewrite.java.migrate.concurrent.MigrateAtomicReferenceWeakCompareAndSetToWeakCompareAndSetPlain
mod run . --recipe=org.openrewrite.java.migrate.concurrent.MigrateAtomicReferenceWeakCompareAndSetToWeakCompareAndSetPlain

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Change method name java.util.concurrent.atomic.AtomicReference weakCompareAndSet(..) to weakCompareAndSetPlain