On Tue, 5 Mar 2024 12:17:07 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>>>private static final int EXPECTED = 5;
>> 
>> this var is used only in main, so I kept it as local variable.
>
> There's a difference between _a local variable_ that it is now and _a 
> constant_ declared at the class level. In the latter case, the compiler may 
> eliminate the constant and inline its value; in the former case, it can't do 
> it.
> 
> I am still for making it a real constant declared at the class level as per 
> my suggestion above.

Updated.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17961#discussion_r1512740249

Reply via email to