...
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 is that doing so could not bear any resemblance to what the designer intended when the code was written. 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 Guidelines
[SCG 2010] | Secure Coding Guidelines for the Java Programming Language, Version 3.0 | Guideline 1-1 Limit the accessibility of classes, interfaces, methods, and fields |
Bibliography
Item 13: Minimize the accessibility of classes and members; Item 16: Prefer interfaces to abstract classes | |
[JLS 2011] | |
Chapter 3, Java Language Security Constructs |
...