Skip to content

Add NullCheckInstanceofOperation (java:S4201)#157

Merged
RadikalJin merged 1 commit into
mainfrom
feature/s4201-null-check-instanceof
Jun 11, 2026
Merged

Add NullCheckInstanceofOperation (java:S4201)#157
RadikalJin merged 1 commit into
mainfrom
feature/s4201-null-check-instanceof

Conversation

@RadikalJin

Copy link
Copy Markdown
Member

Removes redundant null checks alongside instanceof, since instanceof already returns false for null. Handles all operand orderings and the negated form (x == null || !(x instanceof Foo)), including within larger && / || chains. Adds InfixExpression support to ClassVisitor to enable operations on binary expressions.

Removes redundant null checks alongside instanceof, since instanceof already
returns false for null. Handles all operand orderings and the negated form
(x == null || !(x instanceof Foo)), including within larger && / || chains.
Adds InfixExpression support to ClassVisitor to enable operations on binary
expressions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@RadikalJin RadikalJin merged commit 144bfa4 into main Jun 11, 2026
2 checks passed
@RadikalJin RadikalJin deleted the feature/s4201-null-check-instanceof branch June 11, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant