Query module ContradictoryTypeChecks

name
Contradictory type checks
description
Contradictory dynamic type checks in instanceof expressions and casts may cause dead code or even runtime errors, and usually indicate a logic error.
kind
problem
problem.severity
error
precision
very-high
id
java/contradictory-type-checks
tags
correctness logic

Imports

Guards
SSA

Provides classes and predicates for SSA representation (Static Single Assignment form).

java

Provides all default Java QL imports.

Predicates

contradictoryTypeCheck

e assumes that v could be of type t, but cond, in fact, ensures that v is not of type sup, which is a supertype of t.

instanceOfCheck

ioe is of the form va instanceof t.

requiresInstanceOf

Expression e assumes that va could be of type t.