RFR: 8375580: Avoid using ArrayDeque in jdk.internal.loader.URLClassPath
Eirik Bjørsnøs
eirbjo at openjdk.org
Mon Jan 19 17:45:04 UTC 2026
On Sun, 18 Jan 2026 09:57:51 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/loader/URLClassPath.java line 490:
>>
>>> 488: for (int i = urls.length - 1; i >= 0; --i) {
>>> 489: loaderPath.addLast(urls[i]);
>>> 490: }
>>
>> Should we do `dfsUrls.addAll(Arrays.asList(urls).reversed())` for simplicity?
>
> Sympathizing with Alan's concern in the JBS about being extra cautious about introducing subtle behaviour changes in this change, I have tried to limit any cleanups not motivated by the change itself to the absolute minimum. Leaving iteration as-is also simplifies the analysis of performance implications.
>
> I agree that the code you suggest expresses the intent much better though. If you feel confident reviewing it despite the stated concerns, I'm happy to apply it. I leave it to you.
> Should we do `dfsUrls.addAll(Arrays.asList(urls).reversed())` for simplicity?
I was overthinking this, suggestion applied, thanks :-)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29288#discussion_r2702340003
More information about the core-libs-dev
mailing list