dns-java icon indicating copy to clipboard operation
dns-java copied to clipboard

Local variable is shadowing class field

Open UdayHE opened this issue 2 years ago • 0 comments

When I was going through one of the class AggregatingChangeNotifier, I saw there is a class field called records and there is a private method in the same class called aggregateSet(), in that method there is a local variable called records. This local variable will override the class field. Overriding or shadowing a variable declared in an outer scope can strongly impact the readability and maintainability, of a piece of code. Also there is a possibility of introducing a bug. So better to rename this local variable.

Screenshot for the same: image

UdayHE avatar Jul 03 '23 08:07 UdayHE