On Tue, 24 Feb 2026 15:23:18 GMT, Eirik Bjørsnøs <[email protected]> wrote:
> 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`. If the given collection 'c' is Collections.synchronziedXXX, then simple loop doesn't lock correctly. ForEach and toArray work correctly with that wrapper class. ------------- PR Comment: https://git.openjdk.org/jdk/pull/29894#issuecomment-3954022125
