...
Detection of public and protected data members is trivial; heuristic detection of the presence or absence of getter and setter wrapper methods is straightforward. However, simply reporting all detected cases without suppressing those cases covered by the exceptions to this rule would produce many false positives and appears unlikely to be satisfactory. Sound detection and application of the exceptions to this rule appears to be infeasible; heuristic techniques may be useful.
Related Guidelines
Guideline 3-2 Define wrapper methods around modifiable internal state | |
CWE ID 766, "Critical Variable Declared Public" |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8a52edf46d054c02-68252194-44074f78-9f929a23-4843e73e2149e2d90e5a37ab"><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="6af96891ddffc1e4-b3ecd421-40294f9b-965fad6a-a4cbfbbc31ec34e0c14c1f80"><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="65259bd16c795bb1-72e88b10-4da3481b-80c6a770-0176213f7ba1bec2d29bdea1"><ac:plain-text-body><![CDATA[ | [[Long 2005 | AA. Bibliography#Long 05]] | §2.2, Public Fields | ]]></ac:plain-text-body></ac:structured-macro> |
...