From d66bec041a857bc3076a20dfeb1aa6037b020db1 Mon Sep 17 00:00:00 2001 From: Lars Grefer Date: Sat, 15 Aug 2020 16:35:54 +0200 Subject: Manual array copy Reports the manual copying of array contents which may be replaced by calls to System.arraycopy(). Signed-off-by: Lars Grefer --- .../src/test/java/org/aspectj/testing/util/options/Values.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'testing/src') diff --git a/testing/src/test/java/org/aspectj/testing/util/options/Values.java b/testing/src/test/java/org/aspectj/testing/util/options/Values.java index 608d4a610..af81692b7 100644 --- a/testing/src/test/java/org/aspectj/testing/util/options/Values.java +++ b/testing/src/test/java/org/aspectj/testing/util/options/Values.java @@ -698,9 +698,7 @@ public class Values { private void add(int i) { if (insert >= input.length) { int[] temp = new int[insert + 256]; - for (int j = 0; j < input.length; j++) { - temp[j] = input[j]; - } + System.arraycopy(input, 0, temp, 0, input.length); input = temp; } input[insert++] = i; @@ -708,9 +706,7 @@ public class Values { private int[] getList() { int[] result = new int[insert]; - for (int i = 0; i < result.length; i++) { - result[i] = input[i]; - } + if (result.length >= 0) System.arraycopy(input, 0, result, 0, result.length); return result; } } -- cgit v1.2.3