RFR: 8296535: Unnecessary Vector usage in AquaFileSystemModel.FilesLoader
Andrey Turbanov
aturbanov at openjdk.org
Mon Oct 28 20:57:32 UTC 2024
On Thu, 12 Sep 2024 07:09:36 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> `acceptsList` is created, filled and used only _locally_ in the method `com.apple.laf.AquaFileSystemModel.FilesLoader#run`.
> So we can avoid usage of legacy synchronized `Vector` here and use `ArrayList` instead.
src/java.desktop/macosx/classes/com/apple/laf/AquaFileSystemModel.java line 290:
> 288: // Arbitrarily establishing partition element as the midpoint of
> 289: // the array.
> 290: mid = v.get((lo0 + hi0) / 2);
BTW integer overflow is possible here, which can result in `IndexOutOfBoundsException`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20962#discussion_r1756267236
More information about the client-libs-dev
mailing list