code pal for ABAP > Documentation > Interface in Class Check
This check searches for classes with public methods that are not part of an interface. Methods that are not part of an interface make decoupling more difficult and, especially if the class is declared as final, are much harder to mock in unit tests of consumers.
This check searches for declarations of methods within the public section of a class that are not redefinitions. It does not care about static methods (CLASS-METHODS
).
Make sure to create an interface for public methods.
In exceptional cases, you can suppress this finding by using the pseudo comment "#EC INTF_IN_CLASS
which should be placed right after the PUBLIC SECTION
statement:
CLASS class_name DEFINITION.
PUBLIC SECTION. "#EC INTF_IN_CLASS
ENDCLASS.