Skip to content

Design for Inheritance or Prohibit It (FINAL) ​

WarningClean ABAP & Modern SyntaxQuickFix Ready#EC FINAL_CLSRemote Enabled

Overview ​

Prefer FINAL classes and methods by default.

ATC Finding Messages:

  • Classes should be marked FINAL by default unless designed for inheritance
  • Declare method as FINAL if it is not intended to be redefined

Rationale ​

A class that is not designed for inheritance can still be subclassed, and subclasses may depend on internal behavior that later changes. Marking the class FINAL prevents fragile base class problems and documents that no extension is intended. Remove FINAL only when the class has documented extension points.

Non-Compliant ​

abap
CLASS cl_customer_service DEFINITION
  PUBLIC CREATE PUBLIC.
  PUBLIC SECTION.
    METHODS execute.
ENDCLASS.

Compliant ​

abap
CLASS cl_customer_service DEFINITION
  PUBLIC FINAL CREATE PUBLIC.
  PUBLIC SECTION.
    METHODS execute.
ENDCLASS.

Automated QuickFix ​

This rule provides an automated QuickFix directly in Eclipse ABAP Development Tools (ADT):

  1. Position the cursor on the flagged statement.
  2. Press Ctrl + 1 (Quick Assist).
  3. Select the automated refactoring to apply the clean syntax immediately.

Configuration & Thresholds ​

This check can be fine-tuned directly in the ATC Check Variant Editor (CHKV) in Eclipse ADT:

Parameter NameData TypeDefault Value
CHECK_CLASSESBooleantrue
CHECK_METHODSBooleantrue

Suppression ​

To suppress findings for this rule, append the pseudo-comment to the statement:

abap
" Standard pseudo-comment:
... "#EC FINAL_CLS

" SAP CI_ prefix format:
... "#EC CI_FINAL_CLS

Technical Details ​

Released under the MIT License.