Skip to content
vetkitChecksChangelogDocumentation

vetkit.java.quality.string-reference-equality

Strings are compared with == / !=, which compares object identity instead of content. The result depends on interning and is usually wrong.

Last updated:

Suite: Code quality

java

Strings are compared with == / !=, which compares object identity instead of content. The result depends on interning and is usually wrong.

Category: QUALITY · Engine rule severity: WARNING

How to fix it

Use a.equals(b), or Objects.equals(a, b) when either side may be null.

References

Source: packages/engine/rules/quality/java.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.