Alias never reassigned
alias_never_reassigned
Description
Finds DATA(a) = b. where neither a nor b changes afterwards, so b can be read instead of a
Extended Information
Reports DATA(a) = b. when all of the following hold:
* a is a local variable of a METHOD, FORM or FUNCTION, and has at least two more references, all of them reads,
which do not take its address, bind a field symbol to it, or pass it to USING, CHANGING or EXPORTING
* b is a local variable, or a component of one, whose address is never taken and which is not written
after the declaration of a; or b is a constant or me
* the declaration is executed before every read on every path: each read is in the block of the declaration
or a nested block
a has the type of b, so reading b instead does not change any conversion.
A constant b read in IF, ELSEIF, WHILE, CHECK, CASE or WHEN is not reported, see constant_condition.
Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
INCLUDE, test seams, enhancements or native SQL.
The quick fix deletes the declaration and replaces every read of a with b. No release requirement.
See also unnecessary_copy for copies that are read once, also of attributes and parameters.