| Wiki Markup |
|---|
Immutability helps to supporting security reasoning. It is safe to share immutable objects, without risk that the recipient can modify something that we are relying upon \[java:[Mettler 2010B|AA. Bibliography#MettlerReferences#Mettler 2010B]\]. |
| Wiki Markup |
|---|
Programmers could incorrectly expect that declaring a field or variable {{final}} makes the referenced object immutable. Declaring variables that have a primitive type to be {{final}} does prevent changes to their values after initialization (unless the unsupported {{sun.misc.Unsafe}} class is used). However, when the variable has a reference type, the presence of a {{final}} clause in the declaration only makes _the reference itself_ immutable. The {{final}} clause has no effect on the referenced object. Consequently, the fields of the referenced object can be mutable. For example, according to the _Java Language Specification_ \[java:[JLS 2005|AA. Bibliography#JLSReferences#JLS 05]\], [§4.12.4|http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.12.4], "{{final}} Variables," |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e3a016e72bd02ef0-03be7b56-4bd04916-8173a3c4-a2cd2e158b3a00168de6d138"><ac:plain-text-body><![CDATA[ | [java:[Bloch 2008 | AA. Bibliography#Bloch References#Bloch 08]] | Item 13: Minimize the accessibility of classes and members | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4c7d48b80ffa1b49-45136631-4699401f-bc4ba081-3fbfad5210b3e600c4a45c5f"><ac:plain-text-body><![CDATA[ | [java:[Core Java 2004 | AA. Bibliography#Core References#Core Java 04]] | Chapter 6 | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="1d643895522ccbd7-b7a39494-44ad4d01-872fbb98-13909f73919656ab592d6be8"><ac:plain-text-body><![CDATA[ | [java:[JLS 2005 | AA. Bibliography#JLS References#JLS 05]] | [§4.12.4 "final Variables" | http://java.sun.com/docs/books /jls/third_edition/html/typesValues.html#4.12.4] ]]></ac:plain-text-body></ac:structured-macro> |
| ||||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e0af5779d4818858-84e8e8e8-4b3c4536-b53787ae-f43f4418041e2a39e6e1a4aa"><ac:plain-text-body><![CDATA[ | [java:[Mettler 2010B | AA. Bibliography#Mettler References#Mettler 2010B]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
...