RFR: 8376406: Avoid loading ArrayDeque in jdk.internal.loader.NativeLibraries [v2]
Eirik Bjørsnøs
eirbjo at openjdk.org
Sat Feb 21 09:58:08 UTC 2026
On Sat, 21 Feb 2026 08:41:06 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> It looks okay but fragile in the sense that ArrayDeque is widely used, it's just a question on when rather if it will be loaded.
Understood. My goal here and with the preceding ones in `ZipFile` and `URLClassPath` was to remove ArrayDeque from startup of a simple `java -cp file.jar` program. No plans to go hunting for more after this.
Specifically for this change: Do you have any sense if `new ArrayList()` would be beneficial here, given that ArrayLIst provides lazy initialization of the elements array while ArrayDeque does not and allocates 17 elements per default constructor?
In other words, is it common for this stack to be empty?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29432#discussion_r2836034908
More information about the core-libs-dev
mailing list