On Sun, 4 Jul 2021 20:42:41 GMT, Andrey Turbanov 
<github.com+741251+turban...@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.

@turbanoff hi, I've filed an issue for this: 
https://bugs.openjdk.java.net/browse/JDK-8271603

src/java.desktop/share/classes/java/awt/Menu.java line 489:

> 487:     }
> 488: 
> 489:     synchronized Enumeration<MenuShortcut> shortcuts() {

I'm not sure whether it's ok to change return type here, probably it'd be 
better to keep `Enumeration` and use `return 
Collections.enumeration(shortcuts);` in the last line

src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java line 244:

> 242:         }
> 243: 
> 244:         return list.toArray(new Line.Info[list.size()]);

Shouldn't it be `new Line.Info[0]` as in the class below?

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

PR: https://git.openjdk.java.net/jdk/pull/4680

Reply via email to