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