...
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
pbeing boxed istrue,false, abyte, acharin the range\u0000to\u007f, or anintorshortnumber between-128and127, then letr1andr2be 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 |
...