Versions Compared

Key

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

...

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 Guidelines

SCG 2009 Secure Coding Guidelines for the Java Programming Language, Version 3.0

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="10f66aba38eb4e33-9b4df091-45b3453a-a4218198-961bacbbce61eaa8f6844436"><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="37984ed4bc843794-a9eb650a-43374d8f-ba1dbe2b-6767ec7500e4e3a208b5c9a9"><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="eaffa0cd02c8b041-ebc78d33-477f4c99-b7b9bd8d-c796756e6450a4a2c467d058"><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="050578b8e43458b1-064ac23e-4fa44c97-b7c8aa2c-3041c535771e1e944203c042"><ac:plain-text-body><![CDATA[

[[McGraw 1999

AA. Bibliography#McGraw 99]]

Chapter 3, Java Language Security Constructs

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

...