RFR: 8302815 Use new Math.clamp method in core libraries
Tagir F. Valeev
tvaleev at openjdk.org
Sat Feb 18 10:58:10 UTC 2023
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.
-------------
Commit messages:
- 8302815 Use new Math.clamp method in core libraries
Changes: https://git.openjdk.org/jdk/pull/12633/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12633&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8302815
Stats: 41 lines in 12 files changed: 0 ins; 8 del; 33 mod
Patch: https://git.openjdk.org/jdk/pull/12633.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12633/head:pull/12633
PR: https://git.openjdk.org/jdk/pull/12633
More information about the core-libs-dev
mailing list