Replace System.getSecurityManager() with null

MSAL

The Security Manager API is unsupported in Java 24. This recipe will replace System.getSecurityManager() with null to make its behavior more obvious and try to simplify execution paths afterwards.

org.openrewrite.java.migrate.SystemGetSecurityManagerToNull
mod run . --recipe=org.openrewrite.java.migrate.SystemGetSecurityManagerToNull

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. Replace method invocation with constant
  2. Simplify the removed security manager's thread group fallback
  3. Simplify constant if branch execution