Use String.equals() on String literals

MSAL

String.equals() should be used when checking value equality on String literals. Using == or != compares object references, not the actual value of the Strings. This only modifies code where at least one side of the binary operation (== or !=) is a String literal, such as "someString" == someVariable;. This is to prevent inadvertently changing code where referential equality is the user's intent. Reference equality on strings is fragile because it depends on JVM string interning behavior, which can vary across runtimes and is not guaranteed for dynamically constructed strings.

org.openrewrite.staticanalysis.StringLiteralEquality
mod run . --recipe=org.openrewrite.staticanalysis.StringLiteralEquality

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