GLOBAL.SPAC
Non-subclassed package-private classes should be declared "final"
Description
This rule flags non-subclassed package-private classes that are not declared "final".
There are two advantages to declaring these classes "final":
- It optimizes the code. The compiler knows that nobody can extend the class or override its methods, so it can generate optimized code.
- It makes the code self documented. Somebody looking at the class will know that no other class extends this class.
Repair
Add the keyword "final" or document the reason for the class not being final.
|