On Mon, 5 Jul 2021 14:03:18 GMT, Сергей Цыпанов <github.com+10835776+stsypa...@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. > > 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 It's not a public API. As I see from other PR/commits changing package-private methods shouldn't be a problem. ------------- PR: https://git.openjdk.java.net/jdk/pull/4680