Why is this an issue?

Programming languages evolve over time, and new versions of Java introduce additional keywords. If future keywords are used in the current code, it can create compatibility issues when transitioning to newer versions of Java. The code may fail to compile or behave unexpectedly due to conflicts with newly introduced keywords.

The _ keyword was deprecated in Java 9 and disallowed since Java 11. Starting from Java 22 the _ was introduced as unnamed variable.

This rule reports an issue when _ is used in versions prior to Java 22.

How to fix it

Rename the _ identifiers.

Code examples

Noncompliant code example

public class MyClass {
    String _ = "";            // Noncompliant
}

Compliant solution

public class MyClass {
    String s = "";            // Noncompliant
}

Resources

Documentation