Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
Autoboxing automatically wraps a value of a primitive type with the corresponding wrapper object. The [§5§5.1.7, "Boxing Conversion,"|http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7] of the _Java Language Specification_ \[[JLS 2005|AA. Bibliography#JLS 05]\] explains which primitive values are memoized during autoboxing: 

...

Less memory-limited implementations could, for example, cache all characters and shorts, as well as integers and longs in the range of -32K — +32K.

Code that depends on implementation-defined behavior is not portable.

...

Code Block
bgColor#CCCCFF
Boolean b1 = true; // Or Boolean.True
Boolean b2 = true; // Or Boolean.True
b1 == b2;          // always equal

Exceptions

EXP03-EX0EX1 In the unusual case where a program is guaranteed to execute only on a single implementation, it is permissible to depend upon implementation-specific ranges of memoized vulnerabilities.

...

Detection of all uses of the reference equality operators on boxed primitive objects is straightforward. Determining the correctness of such uses is infeasible in the general case.

Bibliography

<ac:structured-macro ac:name="unmigrated-wiki-markup

...

" ac:schema-version="1" ac:macro-id="f80a44ed-6dfe-47d3-9582-d92a4d611602"><ac:plain-text-body><![CDATA[

[[Bloch

...

2009

...

AA.

...

Bibliography#Bloch

...

09]

...

]

...

4.

...

"Searching

...

for

...

the

...

One"

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="b170117f-24a0-4a2d-bd81-1e524dbb24e2"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

[§5.1.7, "Boxing Conversion"

http://java.sun.com/docs/books/jls/third_edition/html/conversions.html#5.1.7]

...

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="0ef7c31e-fdec-41d5-9c2e-09e8c61bb6a9"><ac:plain-text-body><![CDATA[

[[Pugh 2009

AA. Bibliography#Pugh 09]]

Using == to compare objects rather than .equals

]]></ac:plain-text-body></ac:structured-macro>

...

EXP02-J. Use the two-argument Arrays.equals() method to compare the contents of arrays      02. Expressions (EXP)      EXP04-J. Do not perform assignments in conditional statements