<i18n dev> RFR: 8271603: Unnecessary Vector usage in java.desktop [v6]
Sergey Bylokhov
serb at openjdk.java.net
Fri Sep 3 03:20:38 UTC 2021
On Wed, 1 Sep 2021 19:46:51 GMT, Andrey Turbanov <github.com+741251+turbanoff at openjdk.org> wrote:
>> Usage of thread-safe collection `Vector` is unnecessary. It's recommended to use `ArrayList` if a thread-safe implementation is not needed. In post-BiasedLocking times, this is gets worse, as every access is synchronized.
>> I checked only places where `Vector` was used as local variable.
>
> Andrey Turbanov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:
>
> - Merge remote-tracking branch 'origin/master' into avoid-unnecessary-vector-usage-in-java.desktop
>
> # Conflicts:
> # src/java.desktop/share/classes/sun/awt/shell/ShellFolder.java
> - 8271603: Unnecessary Vector usage in java.desktop
> use toArray with zero sized array in places where Vector.copyInto was used
> - 8271603: Unnecessary Vector usage in java.desktop
> migrate even more usages
> - 8271603: Unnecessary Vector usage in java.desktop
> migrate more usages. Not sure how I missed them
> - 8271603: Unnecessary Vector usage in java.desktop
> revert back to use cycle to copy into array
> - 8271603: Unnecessary Vector usage in java.desktop
> revert back to Enumeration
> bring back default values
> - [PATCH] Unnecessary Vector usage in java.desktop
> use zero-length array
> - [PATCH] Unnecessary Vector usage in java.desktop
src/java.desktop/share/classes/javax/swing/text/html/CSS.java line 1578:
> 1576: }
> 1577: String[] retValue = new String[temp.size()];
> 1578: temp.toArray(retValue);
Why not `return temp.toArray(new String[0]);` like in other places in the last commit?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4680
More information about the i18n-dev
mailing list