Query module BoxedVariable

name
Boxed variable is never null
description
Using a boxed type for a variable that is never assigned ‘null’ hinders readability because it implies that ‘null’ is a potential value.
kind
problem
problem.severity
warning
precision
very-high
id
java/non-null-boxed-variable
tags
readability types

Imports

java

Provides all default Java QL imports.

Predicates

affectsOverload

Replacing the type of a boxed variable with the corresponding primitive type may affect overload resolution. If this is the case then the boxing is most likely intentional and it should not be reported as a violation.

notDeliberatelyBoxed

If a primitive value always occurs in a boxed context (and maybe more than once for each assigned value), then declaring the type as a boxed type merely performs the boxing up front and is likely deliberate.

Classes