...
Autoboxing automatically wraps a value of a primitive type with the corresponding wrapper object. The Java Language Specification (JLS), §5.1.7, "Boxing Conversion" [JLS 2015], explains which primitive values are memoized during autoboxing:
If the value
p
being boxed istrue
,false
, abyte
, achar
in the range\u0000
to\u007f
, or anint
orshort
number between-128
and127
, then letr1
andr2
be the results of any two boxing conversions ofp
. It is always the case thatr1 == r2
.
...
Tool | Version | Checker | Description |
---|---|---|---|
Coverity | 7.5 | BAD_EQ | Implemented |
Parasoft Jtest | 9.5 | PB.CUB.UEIC |
Related Guidelines
CWE-595, Comparison of Object References Instead of Object Contents |
...