Versions Compared

Key

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

...

A related error can arise when a programmer declares a static final reference to a mutable object; see guideline "OBJ02-J. Never conflate immutability of a reference with that of the referenced object" for additional information.

...

Wiki Markup
According to [§13.4.9, "{{final}} Fields and Constants" |http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#13.4.9] "{{final}} Fields and Constants" of the _Java Language Specification_ \[[JLS 2005|AA. Bibliography#JLS 05]\]

...

Exceptions

Wiki Markup
*DCL04-EX0EX1*: According to [§9.3, "Field (Constant) Declarations" |http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.3] "Field (Constant) Declarations" of the _Java Language Specification_ \[[JLS 2005|AA. Bibliography#JLS 05]\],
"Every field declaration in the body of an interface is implicitly {{public}}, {{static}}, and {{final}}. It is permitted to redundantly specify any or all of these modifiers for such fields."

DCL04-EX1EX2: Constants declared using the enum type are permitted to violate this guideline.

DCL04-EX2EX3: Constants whose value never changes throughout the entire lifetime of the software may be declared as final. For instance, the Java Language Specification recommends that mathematical constants be declared final.

...

C Secure Coding Standard: "DCL00-C. Const-qualify immutable objects"

Bibliography

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

...

" ac:schema-version="1" ac:macro-id="b7d1a6e5-675c-49d7-9503-b5fa960bf81b"><ac:plain-text-body><![CDATA[

[[JLS

...

2005

...

AA.

...

Bibliography#JLS

...

05]

...

]

...

[§13.4.9

...

, "final Fields and Constants"

http://java.sun.com/docs/books/jls/third_edition/html/binaryComp.html#13.4.9

...

]

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

 

§9.3, "Field (Constant) Declarations"

 

§4.12.4, "final Variables"

 

§8.3.1.1

...

...

DCL03-J. Properly encode relationships in constant definitions      01. Declarations and Initialization (DCL)      DCL05-J. Declare all enhanced for statement loop variables to be final