diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 16:35:54 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 16:35:54 +0200 |
commit | d66bec041a857bc3076a20dfeb1aa6037b020db1 (patch) | |
tree | ab29bd5c21811b4d3564e549e820bd518ceb2680 /org.aspectj.ajdt.core | |
parent | efa2e5ce8c9cc2d20ab7479d1caa4a2ae1de6e8a (diff) | |
download | aspectj-d66bec041a857bc3076a20dfeb1aa6037b020db1.tar.gz aspectj-d66bec041a857bc3076a20dfeb1aa6037b020db1.zip |
Manual array copy
Reports the manual copying of array contents which may be replaced by calls to System.arraycopy().
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r-- | org.aspectj.ajdt.core/src/test/java/RunWeaveTests.java | 66 |
1 files changed, 21 insertions, 45 deletions
diff --git a/org.aspectj.ajdt.core/src/test/java/RunWeaveTests.java b/org.aspectj.ajdt.core/src/test/java/RunWeaveTests.java index e54ab44e2..ad68e64d5 100644 --- a/org.aspectj.ajdt.core/src/test/java/RunWeaveTests.java +++ b/org.aspectj.ajdt.core/src/test/java/RunWeaveTests.java @@ -51,44 +51,30 @@ public class RunWeaveTests { WeaveTest.main( split(SMALL_PROGRAM_ARGS + "-echo -i " + ITERATIONS)); - for (int i = 0; i < ITERATIONS; i++) - times[0][i] = WeaveTest.compileTimes[i]; + System.arraycopy(WeaveTest.compileTimes, 0, times[0], 0, ITERATIONS); - for (int i = 0; i < ITERATIONS; i++) - times[1][i] = WeaveTest.executionFastTimes[i]; - for (int i = 0; i < ITERATIONS; i++) - times[2][i] = WeaveTest.executionMedTimes[i]; - for (int i = 0; i < ITERATIONS; i++) - times[3][i] = WeaveTest.executionSlowTimes[i]; + System.arraycopy(WeaveTest.executionFastTimes, 0, times[1], 0, ITERATIONS); + System.arraycopy(WeaveTest.executionMedTimes, 0, times[2], 0, ITERATIONS); + System.arraycopy(WeaveTest.executionSlowTimes, 0, times[3], 0, ITERATIONS); - for (int i = 0; i < ITERATIONS; i++) - times[4][i] = WeaveTest.getFastTimes[i]; - for (int i = 0; i < ITERATIONS; i++) - times[5][i] = WeaveTest.getMedTimes[i]; - for (int i = 0; i < ITERATIONS; i++) - times[6][i] = WeaveTest.getSlowTimes[i]; + System.arraycopy(WeaveTest.getFastTimes, 0, times[4], 0, ITERATIONS); + System.arraycopy(WeaveTest.getMedTimes, 0, times[5], 0, ITERATIONS); + System.arraycopy(WeaveTest.getSlowTimes, 0, times[6], 0, ITERATIONS); } if (RUN_MED) { WeaveTest.main( split(MEDIUM_PROGRAM_ARGS + "-echo -i " + ITERATIONS)); - for (int i = ITERATIONS; i < (2 * ITERATIONS); i++) - times[0][i] = WeaveTest.compileTimes[i - ITERATIONS]; + System.arraycopy(WeaveTest.compileTimes, 0, times[0], ITERATIONS, 2 * ITERATIONS - 3); - for (int i = ITERATIONS; i < (2 * ITERATIONS); i++) - times[1][i] = WeaveTest.executionFastTimes[i - ITERATIONS]; - for (int i = ITERATIONS; i < (2 * ITERATIONS); i++) - times[2][i] = WeaveTest.executionMedTimes[i - ITERATIONS]; - for (int i = ITERATIONS; i < (2 * ITERATIONS); i++) - times[3][i] = WeaveTest.executionSlowTimes[i - ITERATIONS]; + System.arraycopy(WeaveTest.executionFastTimes, 0, times[1], ITERATIONS, 2 * ITERATIONS - 3); + System.arraycopy(WeaveTest.executionMedTimes, 0, times[2], ITERATIONS, 2 * ITERATIONS - 3); + System.arraycopy(WeaveTest.executionSlowTimes, 0, times[3], ITERATIONS, 2 * ITERATIONS - 3); - for (int i = ITERATIONS; i < (2 * ITERATIONS); i++) - times[4][i] = WeaveTest.getFastTimes[i - ITERATIONS]; - for (int i = ITERATIONS; i < (2 * ITERATIONS); i++) - times[5][i] = WeaveTest.getMedTimes[i - ITERATIONS]; - for (int i = ITERATIONS; i < (2 * ITERATIONS); i++) - times[6][i] = WeaveTest.getSlowTimes[i - ITERATIONS]; + System.arraycopy(WeaveTest.getFastTimes, 0, times[4], ITERATIONS, 2 * ITERATIONS - 3); + System.arraycopy(WeaveTest.getMedTimes, 0, times[5], ITERATIONS, 2 * ITERATIONS - 3); + System.arraycopy(WeaveTest.getSlowTimes, 0, times[6], ITERATIONS, 2 * ITERATIONS - 3); } @@ -96,25 +82,15 @@ public class RunWeaveTests { WeaveTest.main( split(LARGE_PROGRAM_ARGS + "-echo -i " + ITERATIONS)); - for (int i = (2 * ITERATIONS); i < (3 * ITERATIONS); i++) - times[0][i] = WeaveTest.compileTimes[i - (2 * ITERATIONS)]; + System.arraycopy(WeaveTest.compileTimes, 0, times[0], 2 * ITERATIONS, 3 * ITERATIONS - 6); - for (int i = (2 * ITERATIONS); i < (3 * ITERATIONS); i++) - times[1][i] = - WeaveTest.executionFastTimes[i - (2 * ITERATIONS)]; - for (int i = (2 * ITERATIONS); i < (3 * ITERATIONS); i++) - times[2][i] = - WeaveTest.executionMedTimes[i - (2 * ITERATIONS)]; - for (int i = (2 * ITERATIONS); i < (3 * ITERATIONS); i++) - times[3][i] = - WeaveTest.executionSlowTimes[i - (2 * ITERATIONS)]; + System.arraycopy(WeaveTest.executionFastTimes, 0, times[1], 2 * ITERATIONS, 3 * ITERATIONS - 6); + System.arraycopy(WeaveTest.executionMedTimes, 0, times[2], 2 * ITERATIONS, 3 * ITERATIONS - 6); + System.arraycopy(WeaveTest.executionSlowTimes, 0, times[3], 2 * ITERATIONS, 3 * ITERATIONS - 6); - for (int i = (2 * ITERATIONS); i < (3 * ITERATIONS); i++) - times[4][i] = WeaveTest.getFastTimes[i - (2 * ITERATIONS)]; - for (int i = (2 * ITERATIONS); i < (3 * ITERATIONS); i++) - times[5][i] = WeaveTest.getMedTimes[i - (2 * ITERATIONS)]; - for (int i = (2 * ITERATIONS); i < (3 * ITERATIONS); i++) - times[6][i] = WeaveTest.getSlowTimes[i - (2 * ITERATIONS)]; + System.arraycopy(WeaveTest.getFastTimes, 0, times[4], 2 * ITERATIONS, 3 * ITERATIONS - 6); + System.arraycopy(WeaveTest.getMedTimes, 0, times[5], 2 * ITERATIONS, 3 * ITERATIONS - 6); + System.arraycopy(WeaveTest.getSlowTimes, 0, times[6], 2 * ITERATIONS, 3 * ITERATIONS - 6); } |