Versions Compared

Key

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

It is difficult to control how data members declared public or protected are accessed. Attackers can manipulate such members in unexpected ways. Therefore As a result data members must be declared private. Use wrapper accessor methods to expose class members that are beyond the package in which their class is declared. Using wrapper methods enables appropriate monitoring and control of the modification of data members (for example, by defensive copying, validating input, and logging). The wrapper methods can preserve class invariants.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="99f6c6e599ecfd8f-abfd73a4-494444e1-b6b8b425-98530272837cfcb8a74110aa"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. Bibliography#Bloch 08]]

Items 13: Minimize the accessibility of classes and members; 14: In public classes, use accessor methods, not public fields

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6f8f966e000674d7-047cf2d6-491f4533-87e28424-99f14b9724eb910e4ecf10ff"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. Bibliography#JLS 05]]

[§6.6 "Access Control"

http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6]

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="886bbd27c0b9e716-81489a4c-456f4d7d-a493998e-fec7fdfc569b9023cdbf40aa"><ac:plain-text-body><![CDATA[

[[Long 2005

AA. Bibliography#Long 05]]

§2.2, Public Fields

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

...