SAP / SAP/code-pal-for-abap

Class Method called on instance

Open
#330 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

new check
Dominant language
ABAP
Stars
435
Forks
77
PR merge metrics
No merged PRs in 30d

Description

Such a check is known from other programming languages (Java, C# etc.), and it would be great to have it in ABAP, too: Static methods should only be called on the class (=>), NOT on an instance (->), because if someone calls a static method on an instance, they probably don't know what is really happening. (I just discovered such a case in our code which was copied a lot to other places; a check would have helped to discover this: CL_FARR_TD_UTILITY_FACTORY=>CREATE_DOUBLE( )->INJECT_ITSELF( … ) is called, but INJECT_ITSELF is a class-method.) Grassau, Joerg-Michael

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are identified in the issue. Start by locating the existing ABAP check entry point for method-call rules and reviewing how violations are tested; done means flagging static methods called with instance syntax while allowing class syntax.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.