RFR: 8357798: ReverseOrderListView allocates Boolean boxes
Aleksey Shipilev
shade at openjdk.org
Mon May 26 17:16:01 UTC 2025
SonarCloud complains that since [JDK-8356080](https://bugs.openjdk.org/browse/JDK-8356080) we are allocating and using `Boolean` boxes in `ReverseOrderListView`. This change `boolean` -> `Boolean` was made in [JDK-8356080](https://bugs.openjdk.org/browse/JDK-8356080) to allow `@Stable` folding of boolean field. But it is very awkward to trade in the object allocation on common path to allow optional constant folding.
We can flatten this field to `byte` and check the specific non-zero values. The field is final, so it is never actually in `0` state.
Additional testing:
- [x] Linux x86_64 server fastdebug, `java/util`
-------------
Commit messages:
- A bit better comment
- Better fix
- Fix
Changes: https://git.openjdk.org/jdk/pull/25456/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25456&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8357798
Stats: 14 lines in 1 file changed: 11 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/25456.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25456/head:pull/25456
PR: https://git.openjdk.org/jdk/pull/25456
More information about the core-libs-dev
mailing list