RFR: 8378580: Make ArrayDeque bulk add methods bootstrap-proof [v2]

Eirik Bjørsnøs eirbjo at openjdk.org
Wed Feb 25 11:04:33 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`.

Eirik Bjørsnøs has updated the pull request incrementally with one additional commit since the last revision:

  Use anonymous class to avoid external/synchronized iteration of passed collection

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/29894/files
  - new: https://git.openjdk.org/jdk/pull/29894/files/aa97fb6b..d8d6296f

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=29894&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29894&range=00-01

  Stats: 7 lines in 1 file changed: 4 ins; 0 del; 3 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