RFR: 8302815 Use new Math.clamp method in core libraries [v2]
Alan Bateman
alanb at openjdk.org
Mon Feb 20 17:40:26 UTC 2023
On Sat, 18 Feb 2023 21:40:08 GMT, Tagir F. Valeev <tvaleev at openjdk.org> wrote:
>> For cleanup and dogfooding the new method, it would be nice to use Math.clamp where possible in java.base. See PR #12428.
>>
>> As Math.clamp performs an additional check that min is not greater than max, I conservatively replaced only those occurrences where I can see that this invariant is always held. There are more occurrences, where clamp can be potentially used but it's unclear whether min <= max is always true.
>
> Tagir F. Valeev has updated the pull request incrementally with one additional commit since the last revision:
>
> Revert changes in JrtPath, as it seems to be compiled with bootstrap JDK
I skimmed through the usages and they look okay. I didn't spot anywhere that it differs to the existing clamping. This is the first update in 2023 for some of these files so I assume you'll bump the copyright year before integrating.
-------------
Marked as reviewed by alanb (Reviewer).
PR: https://git.openjdk.org/jdk/pull/12633
More information about the nio-dev
mailing list