Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated a reference to Java 7

...

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

Bibliography

[Bloch 2008]

Item 13: Minimize the accessibility of classes and members; Item 16: Prefer interfaces to abstract classes

[Campione 1996]

Access Control

[JLS 2011]

§6.6, Access Control

[McGraw 1999]

Chapter 3, Java Language Security Constructs

...