From f5431c3bb14854025dc1f0ec470b77497f79494c Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 29 Aug 2014 21:58:12 +0400 Subject: java-decompiler: post-import cleanup (common fixes and optimizations) --- .../java/decompiler/util/FastSparseSetFactory.java | 2 +- .../jetbrains/java/decompiler/util/InterpreterUtil.java | 3 +-- .../java/decompiler/util/SFormsFastMapDirect.java | 15 ++++++++------- .../jetbrains/java/decompiler/util/VBStyleCollection.java | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/org/jetbrains/java/decompiler/util') diff --git a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java index 863dd72..bf01035 100644 --- a/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java +++ b/src/org/jetbrains/java/decompiler/util/FastSparseSetFactory.java @@ -253,7 +253,7 @@ public class FastSparseSetFactory { } } - private void changeNext(int[] arrnext, int key, int oldnext, int newnext) { + private static void changeNext(int[] arrnext, int key, int oldnext, int newnext) { for (int i = key - 1; i >= 0; i--) { if (arrnext[i] == oldnext) { arrnext[i] = newnext; diff --git a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java index a1da87b..89e11c0 100644 --- a/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java +++ b/src/org/jetbrains/java/decompiler/util/InterpreterUtil.java @@ -83,9 +83,8 @@ public class InterpreterUtil { return false; } - HashSet set = new HashSet(c1); + HashSet set = new HashSet(c1); set.removeAll(c2); - return (set.size() == 0); } diff --git a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java index 089225d..996607a 100644 --- a/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java +++ b/src/org/jetbrains/java/decompiler/util/SFormsFastMapDirect.java @@ -27,7 +27,7 @@ public class SFormsFastMapDirect { private int size; - private FastSparseSet[][] elements = new FastSparseSet[3][]; + @SuppressWarnings("unchecked") private FastSparseSet[][] elements = new FastSparseSet[3][]; private int[][] next = new int[3][]; @@ -38,7 +38,8 @@ public class SFormsFastMapDirect { private SFormsFastMapDirect(boolean initialize) { if (initialize) { for (int i = 2; i >= 0; i--) { - elements[i] = new FastSparseSet[0]; + @SuppressWarnings("unchecked") FastSparseSet[] empty = new FastSparseSet[0]; + elements[i] = empty; next[i] = new int[0]; } } @@ -50,7 +51,7 @@ public class SFormsFastMapDirect { int[] arrnext = map.next[i]; int length = arr.length; - FastSparseSet[] arrnew = new FastSparseSet[length]; + @SuppressWarnings("unchecked") FastSparseSet[] arrnew = new FastSparseSet[length]; int[] arrnextnew = new int[length]; System.arraycopy(arr, 0, arrnew, 0, length); @@ -78,7 +79,7 @@ public class SFormsFastMapDirect { if (length > 0) { int[] arrnext = next[i]; - FastSparseSet[] arrnew = new FastSparseSet[length]; + @SuppressWarnings("unchecked") FastSparseSet[] arrnew = new FastSparseSet[length]; int[] arrnextnew = new int[length]; System.arraycopy(arrnext, 0, arrnextnew, 0, length); @@ -174,7 +175,7 @@ public class SFormsFastMapDirect { } } - private void changeNext(int[] arrnext, int key, int oldnext, int newnext) { + private static void changeNext(int[] arrnext, int key, int oldnext, int newnext) { for (int i = key - 1; i >= 0; i--) { if (arrnext[i] == oldnext) { arrnext[i] = newnext; @@ -343,7 +344,7 @@ public class SFormsFastMapDirect { } Set set = entry.getValue().toPlainSet(); - buffer.append(entry.getKey() + "={" + set.toString() + "}"); + buffer.append(entry.getKey()).append("={").append(set.toString()).append("}"); } } @@ -399,7 +400,7 @@ public class SFormsFastMapDirect { } } - FastSparseSet[] arrnew = new FastSparseSet[minsize]; + @SuppressWarnings("unchecked") FastSparseSet[] arrnew = new FastSparseSet[minsize]; System.arraycopy(arr, 0, arrnew, 0, arr.length); int[] arrnextnew = new int[minsize]; diff --git a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java index f4d5968..cdc1762 100644 --- a/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java +++ b/src/org/jetbrains/java/decompiler/util/VBStyleCollection.java @@ -115,7 +115,7 @@ public class VBStyleCollection extends ArrayList { public E remove(int index) { addToListIndex(index + 1, -1); - Object obj = lstKeys.get(index); + K obj = lstKeys.get(index); if (obj != null) { map.remove(obj); } -- cgit v1.2.3