RFR: 8077587: BigInteger Roots [v45]
Raffaello Giulietti
rgiulietti at openjdk.org
Fri Jul 25 15:39:56 UTC 2025
On Fri, 25 Jul 2025 15:26:37 GMT, fabioromano1 <duke at openjdk.org> wrote:
>> Of course.
>> To the caller, a `final` parameter does not convey any information, and makes the method/constructor header less concise.
>> There are thousands of methods in the JDK that do no alter their parameters, and yet these are not annotated with `final`.
>> It's just a matter of convention.
>
> Yes, but in this way you see at a glance that the parameter is a constant, and you do not have to check all the method's code.
I guess most developer use a Java IDE for Java development.
My IDE shows variables that are altered by underlying their name at every occurrence in the code. I can see at a glance that `n` is not modified even without `final`.
As said, it's a matter of convention. In the OpenJDK we usually don't use `final` on parameters, as it clutters the header. Just have a look at a random place in the codebase.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24898#discussion_r2231448074
More information about the core-libs-dev
mailing list