diff --git a/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java b/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java index c7816f88ae..a72ae0bb46 100644 --- a/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java +++ b/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java @@ -344,8 +344,7 @@ public abstract class AbstractMessageLite< int growth = ((Collection) values).size(); if (list instanceof ArrayList) { ((ArrayList) list).ensureCapacity(list.size() + growth); - } - if (list instanceof ProtobufArrayList) { + } else if (list instanceof ProtobufArrayList) { ((ProtobufArrayList) list).ensureCapacity(list.size() + growth); } }