Jtest logo




Contents  Previous  Next  Index

GLOBAL.SPPC


Non-subclassed "public/protected" classes should be declared "final"

Description

This rule flags non-subclassed "public/protected" 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.


Contents  Previous  Next  Index

ParaSoft logo
(888) 305-0041 info@parasoft.com Copyright © 1996-2001 ParaSoft