RFR: 8376406: Avoid loading ArrayDeque in jdk.internal.loader.NativeLibraries

Eirik Bjørsnøs eirbjo at openjdk.org
Mon Jan 26 20:45:49 UTC 2026


Please review this PR which replaces `ArrayDeque` with `ArrayList` for the native library context stack in `jdk.internal.loader.NativeLibraries.NativeLibraryContext`.

With this follow-up to similar changes in #29288 and #29430, a simple JAR-based "hello world" program no longer loads the `ArrayDeque` class during startup.

The change here is mostly a straightforward replacement. The existing processing was a FIFO stack, which it still is after this PR, just backed by ArrayList instead.

Since ArrayList is null-friendly, I added an explicit `Objects.requireNullNull` before pushing to the stack.

Pure refactoring, no tests updated, `noreg-cleanup`.

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

Commit messages:
 - Replace ArrayDeque with ArrayList in NativeLibraries.NativeLibraryContext

Changes: https://git.openjdk.org/jdk/pull/29432/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29432&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8376406
  Stats: 14 lines in 1 file changed: 3 ins; 0 del; 11 mod
  Patch: https://git.openjdk.org/jdk/pull/29432.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29432/head:pull/29432

PR: https://git.openjdk.org/jdk/pull/29432


More information about the core-libs-dev mailing list