Skip to content

Files

Latest commit

 

History

History
36 lines (19 loc) · 563 Bytes

StringLiteralEquality.md

File metadata and controls

36 lines (19 loc) · 563 Bytes

Pattern: Use of == or != for literal string equality

Issue: -

Description

Checks that string literals are not used with == or !=.

Rationale: Novice Java programmers often use code like:

if (x == "something")

when they mean

if ("something".equals(x))

Examples

To configure the check:

<module name="StringLiteralEquality"/>

Further Reading