abap-cleaner icon indicating copy to clipboard operation
abap-cleaner copied to clipboard

"Remove needless CLEAR" for attributes within CONSTRUCTOR methods

Open ConjuringCoffee opened this issue 2 months ago • 0 comments

Hi Jörg-Michael, I would have expected the rule "Remove needless CLEAR" to also work on CLEARs on attributes within the CONSTRUCTOR. Is there any reason why the CLEAR of the following example is not removed?

CLASS zcl_example_clear DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC.

  PUBLIC SECTION.
    METHODS constructor.

  PRIVATE SECTION.
    DATA attribute TYPE i.
ENDCLASS.


CLASS zcl_example_clear IMPLEMENTATION.
  METHOD constructor.
    CLEAR attribute.
  ENDMETHOD.
ENDCLASS.

ConjuringCoffee avatar Oct 14 '25 15:10 ConjuringCoffee