...
For any given body of code, we can compute the minimum accessibility for each class and member so that we do not introduce new compilation errors. The limitation of this is that this could not bear any resemblance to what the designer intended when they wrote it. For example, unused members can obviously be marked private. However, such members could be unused because the particular body of code examined coincidentally lacks references to the members.
Related
...
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
Guideline 1-1 Limit the accessibility of classes, interfaces, methods, and fields |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="44e71ffdf5c8e596-106e4edb-41f248e6-8c4aaef6-b122539ad9df95f77bc91839"><ac:plain-text-body><![CDATA[ | [[Bloch 2008 | AA. Bibliography#Bloch 08]] | Item 13: Minimize the accessibility of classes and members; Item 16: Prefer interfaces to abstract classes | ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="c2cc24c086106e79-1ec85653-46de4c9a-a837910f-80c57bab680964915461cea6"><ac:plain-text-body><![CDATA[ | [[Campione 1996 | AA. Bibliography#Campione 96]] | [Access Control | http://www.telecom.ntua.gr/HTML.Tutorials/java/javaOO/accesscontrol.html] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="2fb5f913c92b3858-5ac2578c-432a45ca-ab7393d5-c76ab6c74f88c6e250cccecb"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. Bibliography#JLS 05]] | [Section 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="af566546060a3f8f-4b929877-489b4e8d-9fdba249-49a4d3aae4be898427fae5a6"><ac:plain-text-body><![CDATA[ | [[McGraw 1999 | AA. Bibliography#McGraw 99]] | Chapter 3, Java Language Security Constructs | ]]></ac:plain-text-body></ac:structured-macro> |
...