Skip to content

Avoid Calling Static Methods via Instance References (->) ​

WarningAnti-Patterns & Bad PracticesQuickFix Ready#EC STATIC_ARROWLocal Only

Overview ​

Avoid calling static methods via instance arrow (->).

ATC Finding Message: Call static method using => instead of ->

Rationale ​

Calling a static method through an instance reference uses the instance arrow and suggests polymorphic dispatch that is not happening. It also creates an unnecessary dependency on a live object. Use the class name with => so readers immediately see that the method is static and cannot be overridden.

Non-Compliant ​

abap
DATA lo_helper TYPE REF TO cl_helper.
lo_helper->format_date( lv_date ).

Compliant ​

abap
cl_helper=>format_date( lv_date ).

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.

Suppression ​

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

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

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

Technical Details ​

Released under the MIT License.