RFR: 8378580: Make ArrayDeque bulk add methods bootstrap-proof
Eirik Bjørsnøs
eirbjo at openjdk.org
Tue Feb 24 15:53:13 UTC 2026
Please review this small change to avoid loading lambda machinery in `ArrayDeque.addAll` and `ArrayDeque(Collection)`.
Core collections like these may be useful in early bootstrap where we want to avoid eager loading of lambda machinery. JDK-8375580 recently showed one example where `URLClassPath` was avoiding these bulk-adding methods exactly to avoid triggering lambdas.
This PR replaces the use of `Collection.forEach` with a plain old for loop.
This was initially discussed here: https://mail.openjdk.org/pipermail/core-libs-dev/2026-February/159362.html
Cleanup, low risk enhancement, `noreg-cleanup`.
-------------
Commit messages:
- Use simple loop instead of lambda in ArrayDeque bulk adds
Changes: https://git.openjdk.org/jdk/pull/29894/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29894&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8378580
Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/29894.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29894/head:pull/29894
PR: https://git.openjdk.org/jdk/pull/29894
More information about the core-libs-dev
mailing list