aboutsummaryrefslogtreecommitdiffstats
path: root/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/javanano/javanano_enum_field.cc')
-rw-r--r--src/google/protobuf/compiler/javanano/javanano_enum_field.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_enum_field.cc b/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
index 2c6fd5d..a22aa6f 100644
--- a/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
+++ b/src/google/protobuf/compiler/javanano/javanano_enum_field.cc
@@ -166,7 +166,9 @@ GenerateParsingCode(io::Printer* printer) const {
printer->Print(variables_,
"int arrayLength = com.google.protobuf.nano.WireFormatNano.getRepeatedFieldArrayLength(input, $tag$);\n"
"int i = this.$name$.length;\n"
- "this.$name$ = java.util.Arrays.copyOf(this.$name$, this.$name$.length + arrayLength);\n"
+ "int[] newArray = new int[i + arrayLength];\n"
+ "System.arraycopy(this.$name$, 0, newArray, 0, i);\n"
+ "this.$name$ = newArray;\n"
"for (; i < this.$name$.length - 1; i++) {\n"
" this.$name$[i] = input.readInt32();\n"
" input.readTag();\n"