diff --git a/common/src/main/java/io/netty/util/internal/InternalThreadLocalMap.java b/common/src/main/java/io/netty/util/internal/InternalThreadLocalMap.java index 25bf537556..7d2a71d56e 100644 --- a/common/src/main/java/io/netty/util/internal/InternalThreadLocalMap.java +++ b/common/src/main/java/io/netty/util/internal/InternalThreadLocalMap.java @@ -192,14 +192,15 @@ public final class InternalThreadLocalMap extends UnpaddedInternalThreadLocalMap return arrayList(DEFAULT_ARRAY_LIST_INITIAL_CAPACITY); } + @SuppressWarnings("unchecked") public ArrayList arrayList(int minCapacity) { ArrayList list = (ArrayList) arrayList; if (list == null) { - list = (ArrayList) new ArrayList(minCapacity); - } else { - list.clear(); - list.ensureCapacity(minCapacity); + arrayList = new ArrayList(minCapacity); + return (ArrayList) arrayList; } + list.clear(); + list.ensureCapacity(minCapacity); return list; }