...
Do not override a method unless absolutely necessary. Declare all methods and fields final
to avoid malicious subclassing. Also, do not increase the accessibility of overridden methods. This is in compliance with the tenets of SEC05-J. Minimize accessibility of classes and their members and OBJ00-J. Declare data members private.
Code Block | ||
---|---|---|
| ||
class BadScope { privateprotected final void doLogic() { System.out.println("Super invoked"); } } |
...