You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove the self-reference me->: Does not work in interface methods #41
generally, ABAP cleaner can only remove "me->" if the method signature is known – otherwise, it could not be sure in your example whether mv_value is both an attribute and at the same time an exporting parameter; in such a case, me-> would of course have to be kept in order to refer to the attribute (not the parameter).
That's why this rule usually does not work on interface methods, where the signature is usually "out of sight". Admittedly, though, that's not the case for local interfaces as in your example – so the rule could indeed be enhanced to process these cases!
I suggest adding this to the documentation of the rule. I just noticed that this limitation also impacts attributes inherited from another global class.
Also, local interfaces are now correctly considered, including aliases and "cascading" cases (interfaces implementing other interfaces and defining aliases for them etc.):
as mentioned before, the perfect solution is unfortunately not possible here as long as we do not introduce backend calls to ABAP cleaner; however, I think this is as good as it gets for now!
Activity
jmgrassau commentedon Jun 2, 2023
Hi ConjuringCoffee,
generally, ABAP cleaner can only remove "me->" if the method signature is known – otherwise, it could not be sure in your example whether
mv_valueis both an attribute and at the same time an exporting parameter; in such a case,me->would of course have to be kept in order to refer to the attribute (not the parameter).That's why this rule usually does not work on interface methods, where the signature is usually "out of sight". Admittedly, though, that's not the case for local interfaces as in your example – so the rule could indeed be enhanced to process these cases!
Kind regards,
Jörg-Michael
ConjuringCoffee commentedon Jun 2, 2023
Hmm, I did not consider that. That's unfortunate - thanks for the explanation!
ConjuringCoffee commentedon Jun 2, 2023
I suggest adding this to the documentation of the rule. I just noticed that this limitation also impacts attributes inherited from another global class.
jmgrassau commentedon Jun 10, 2023
Hi ConjuringCoffee,
I now added some documentation:
Also, local interfaces are now correctly considered, including aliases and "cascading" cases (interfaces implementing other interfaces and defining aliases for them etc.):
Kind regards,
Jörg-Michael
enhance SelfReferenceMeRule for local interfaces and aliases (SAP#41)
enhance SelfReferenceMeRule for local interfaces and aliases (#41)
jmgrassau commentedon Jun 12, 2023
Hi ConjuringCoffee,
as mentioned before, the perfect solution is unfortunately not possible here as long as we do not introduce backend calls to ABAP cleaner; however, I think this is as good as it gets for now!
Kind regards,
Jörg-Michael