Code Inspection: Reuse of local variable
Reports reusing a local variable and overwriting its value with a new value that is not related to the original variable usage. Reusing a local variable in this way may be confusing because the intended semantics of the local variable may vary with each usage. It may also cause bugs, if code changes result in values that were expected to be overwritten while they are actually live. It is good practices to keep variable lifetimes as short as possible, and not reuse local variables for the sake of brevity.
Suppress an inspection in the editor
Place the caret at the highlighted line and press Alt+Enter or click .
Click the arrow next to the inspection you want to suppress and select the necessary suppress action.
Last modified: 25 March 2024