...
Code Block | ||
---|---|---|
| ||
package java.math; // ... public class BigInteger { public BigInteger(String str) { this(str, check()); } private BigInteger(String str, boolean dummy) { // Regular construction goes here } private static boolean check() { securityManagerCheck(); return true; } } |
Automated Detection
This rule recommendation is not checkable because it depends on factors that are unspecified in the code, including the invariants upon which the code relies and the necessity of designating a class as extensible, among others. However, simple statistical methods might be useful to find codebases that violate this rule recommendation by checking whether a given codebase contains a higher-than-average number of classes left nonfinal.
...
[API 2006] | Class |
Item 15: "Minimize mutability" Item 17, "Design and Document for Inheritance or Else Prohibit It" | |
Chapter 6, "Enforcing Security Policy" | |
[Lai 2008] | Java Insecurity, Accounting for Subtleties That Can Compromise Code |
Chapter 7, Rule 3, Make everything final, unless there's a good reason not to | |
[SCG 2009] | Guideline 4-5 / EXTEND-5: Limit the extensibility of classes and methods |
[Ware 2008] |
...