diff --git a/src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java b/src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java index 8697b03..2ad7c68 100644 --- a/src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java +++ b/src/org/jetbrains/java/decompiler/struct/gen/MethodDescriptor.java @@ -68,8 +68,7 @@ public final class MethodDescriptor { VarType[] newParams; if (params.length > 0) { - newParams = new VarType[params.length]; - System.arraycopy(params, 0, newParams, 0, params.length); + newParams = params.clone(); for (int i = 0; i < params.length; i++) { VarType substitute = buildNewType(params[i], builder); if (substitute != null) { diff --git a/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java index 7c2956c..265a538 100644 --- a/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastFixedSetFactory.java @@ -1,10 +1,7 @@ // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.util; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; +import java.util.*; public class FastFixedSetFactory { @@ -66,8 +63,7 @@ public class FastFixedSetFactory { FastFixedSet copy = new FastFixedSet<>(factory); int arrlength = data.length; - int[] cpdata = new int[arrlength]; - System.arraycopy(data, 0, cpdata, 0, arrlength); + int[] cpdata = Arrays.copyOf(data, arrlength); copy.setData(cpdata); return copy; diff --git a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java index a99083c..9b66a2e 100644 --- a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java @@ -1,10 +1,7 @@ // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler.util; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; +import java.util.*; public class FastSparseSetFactory { @@ -97,15 +94,7 @@ public class FastSparseSetFactory { } public FastSparseSet getCopy() { - - int arrlength = data.length; - int[] cpdata = new int[arrlength]; - int[] cpnext = new int[arrlength]; - - System.arraycopy(data, 0, cpdata, 0, arrlength); - System.arraycopy(next, 0, cpnext, 0, arrlength); - - return new FastSparseSet<>(factory, cpdata, cpnext); + return new FastSparseSet<>(factory, data.clone(), next.clone()); } private int[] ensureCapacity(int index) { @@ -119,15 +108,10 @@ public class FastSparseSetFactory { newlength *= 2; } - int[] newdata = new int[newlength]; - System.arraycopy(data, 0, newdata, 0, data.length); - data = newdata; + data = Arrays.copyOf(data, newlength); + next = Arrays.copyOf(next, newlength); - int[] newnext = new int[newlength]; - System.arraycopy(next, 0, newnext, 0, next.length); - next = newnext; - - return newdata; + return data; } public void add(E element) { diff --git a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java index 16a0484..7143281 100644 --- a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java +++ b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java @@ -5,6 +5,7 @@ import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent; import org.jetbrains.java.decompiler.util.FastSparseSetFactory.FastSparseSet; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map.Entry; import java.util.Set; @@ -66,9 +67,7 @@ public class SFormsFastMapDirect { int[] arrnext = next[i]; @SuppressWarnings("unchecked") FastSparseSet[] arrnew = new FastSparseSet[length]; - int[] arrnextnew = new int[length]; - - System.arraycopy(arrnext, 0, arrnextnew, 0, length); + int[] arrnextnew = Arrays.copyOf(arrnext, length); mapelements[i] = arrnew; mapnext[i] = arrnextnew;