On Tue, 6 May 2025 13:03:37 GMT, Jaikiran Pai <j...@openjdk.org> wrote:

> I see that in the proposed changes, we are now using the same names for these 
> local variables and method parameters as the field names. Would using 
> different names for these local variables be better? To avoid shadowing the 
> field names (`value`, `coder` and `count`)? I think that could help prevent 
> future (accidental) refactoring changes that end up unintentionally accessing 
> fields instead of local variables.

A valid concern. Opinions vary about the value/risk of shadowing.
Here the code is more readable using the familiar field names for all of the 
computations and
highlighting the use of `this.` to identify the copying out of and into the 
fields while reviewing and auditing the code.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/24967#issuecomment-2854917666

Reply via email to