Fix up the last handful of FindBugs complaints.
And again, also do a bit of whitespace cleanup.
diff --git a/dx/src/com/android/dx/command/dump/BlockDumper.java b/dx/src/com/android/dx/command/dump/BlockDumper.java
index a4b3993..0858eab 100644
--- a/dx/src/com/android/dx/command/dump/BlockDumper.java
+++ b/dx/src/com/android/dx/command/dump/BlockDumper.java
@@ -59,9 +59,6 @@
*/
protected DirectClassFile classFile;
- /** {@code null-ok;} most recently parsed code attribute */
- private AttCode codeAtt;
-
/** whether or not to suppress dumping */
protected boolean suppressDump;
@@ -101,7 +98,6 @@
this.rop = rop;
this.classFile = null;
- this.codeAtt = null;
this.suppressDump = true;
this.first = true;
this.optimize = args.optimize;
diff --git a/dx/src/com/android/dx/dex/code/LocalList.java b/dx/src/com/android/dx/dex/code/LocalList.java
index 8f2b6f6..326a6c6 100644
--- a/dx/src/com/android/dx/dex/code/LocalList.java
+++ b/dx/src/com/android/dx/dex/code/LocalList.java
@@ -135,7 +135,8 @@
*
* @param address {@code >= 0;} address
* @param disposition {@code non-null;} disposition of the local
- * @param spec {@code non-null;} register spec representing the variable
+ * @param spec {@code non-null;} register spec representing
+ * the variable
*/
public Entry(int address, Disposition disposition, RegisterSpec spec) {
if (address < 0) {
@@ -260,7 +261,8 @@
/**
* Gets the number of the register holding the variable.
*
- * @return {@code >= 0;} the number fo the register holding the variable
+ * @return {@code >= 0;} the number of the register holding
+ * the variable
*/
public int getRegister() {
return spec.getReg();
@@ -472,12 +474,6 @@
private int lastAddress;
/**
- * {@code >= 0;} result index where the first element for the most
- * recent address is stored
- */
- private int startIndexForAddress;
-
- /**
* Constructs an instance.
*/
public MakeState(int initialSize) {
@@ -486,7 +482,6 @@
regs = null;
endIndices = null;
lastAddress = 0;
- startIndexForAddress = 0;
}
/**
@@ -563,7 +558,8 @@
* Starts a local at the given address.
*
* @param address {@code >= 0;} the address
- * @param startedLocal {@code non-null;} spec representing the started local
+ * @param startedLocal {@code non-null;} spec representing the
+ * started local
*/
public void startLocal(int address, RegisterSpec startedLocal) {
int regNum = startedLocal.getReg();
@@ -680,7 +676,8 @@
* Ends a local at the given address.
*
* @param address {@code >= 0;} the address
- * @param endedLocal {@code non-null;} spec representing the local being ended
+ * @param endedLocal {@code non-null;} spec representing the
+ * local being ended
*/
public void endLocal(int address, RegisterSpec endedLocal) {
int regNum = endedLocal.getReg();
@@ -716,7 +713,8 @@
* disposition.
*
* @param address {@code >= 0;} the address
- * @param endedLocal {@code non-null;} spec representing the local being ended
+ * @param endedLocal {@code non-null;} spec representing the
+ * local being ended
* @return {@code true} iff this method found the case in question
* and adjusted things accordingly
*/
diff --git a/dx/src/com/android/dx/ssa/ConstCollector.java b/dx/src/com/android/dx/ssa/ConstCollector.java
index 62f6426..03252d1 100644
--- a/dx/src/com/android/dx/ssa/ConstCollector.java
+++ b/dx/src/com/android/dx/ssa/ConstCollector.java
@@ -17,19 +17,20 @@
package com.android.dx.ssa;
import com.android.dx.rop.code.*;
-import com.android.dx.rop.type.TypeBearer;
+import com.android.dx.rop.cst.Constant;
+import com.android.dx.rop.cst.CstString;
+import com.android.dx.rop.cst.TypedConstant;
import com.android.dx.rop.type.StdTypeList;
import com.android.dx.rop.type.Type;
-import com.android.dx.rop.cst.Constant;
-import com.android.dx.rop.cst.TypedConstant;
-import com.android.dx.rop.cst.CstString;
+import com.android.dx.rop.type.TypeBearer;
-import java.util.HashMap;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
/**
* Collects constants that are used more than once at the top of the
@@ -167,8 +168,7 @@
if (insn == null) continue;
RegisterSpec result = insn.getResult();
-
- TypeBearer typeBearer = insn.getResult().getTypeBearer();
+ TypeBearer typeBearer = result.getTypeBearer();
if (!typeBearer.isConstant()) continue;
@@ -217,13 +217,10 @@
}
// Collect constants that have been reused.
- Iterator<TypedConstant> it = countUses.keySet().iterator();
ArrayList<TypedConstant> constantList = new ArrayList<TypedConstant>();
- while (it.hasNext()) {
- TypedConstant cst = it.next();
-
- if (countUses.get(cst) > 1) {
- constantList.add(cst);
+ for (Map.Entry<TypedConstant, Integer> entry : countUses.entrySet()) {
+ if (entry.getValue() > 1) {
+ constantList.add(entry.getKey());
}
}
@@ -243,6 +240,7 @@
return ret;
}
+
public boolean equals (Object obj) {
return obj == this;
}
diff --git a/dx/src/com/android/dx/ssa/DomFront.java b/dx/src/com/android/dx/ssa/DomFront.java
index 717d3b1..3005015 100644
--- a/dx/src/com/android/dx/ssa/DomFront.java
+++ b/dx/src/com/android/dx/ssa/DomFront.java
@@ -52,9 +52,6 @@
/** {@code >= 0 after run();} the index of the immediate dominator */
public int idom = -1;
-
- /** depth-first traversal index */
- public int traversalIndex;
}
/**
diff --git a/dx/src/com/android/dx/ssa/PhiInsn.java b/dx/src/com/android/dx/ssa/PhiInsn.java
index b3a99eb..64e85ac 100644
--- a/dx/src/com/android/dx/ssa/PhiInsn.java
+++ b/dx/src/com/android/dx/ssa/PhiInsn.java
@@ -361,8 +361,7 @@
public final int blockIndex;
public final int ropLabel; // only used for debugging
- public Operand(final RegisterSpec regSpec, final int blockIndex,
- final int ropLabel) {
+ public Operand(RegisterSpec regSpec, int blockIndex, int ropLabel) {
this.regSpec = regSpec;
this.blockIndex = blockIndex;
this.ropLabel = ropLabel;
diff --git a/dx/src/com/android/dx/ssa/SsaRenamer.java b/dx/src/com/android/dx/ssa/SsaRenamer.java
index ad7ef03..8452c03 100644
--- a/dx/src/com/android/dx/ssa/SsaRenamer.java
+++ b/dx/src/com/android/dx/ssa/SsaRenamer.java
@@ -161,8 +161,8 @@
int sz = ssaRegToRopReg.size();
for (int i = 0; i < sz; i++) {
- int ropReg = ssaRegToRopReg.get(i);
- System.out.println(i +"\t" + ropReg + "["
+ int ropReg = ssaRegToRopReg.get(i);
+ System.out.println(i + "\t" + ropReg + "["
+ versions[ropReg] + "]");
versions[ropReg]++;
}
diff --git a/dx/src/com/android/dx/ssa/back/SsaToRop.java b/dx/src/com/android/dx/ssa/back/SsaToRop.java
index 817912f..0ecbead 100644
--- a/dx/src/com/android/dx/ssa/back/SsaToRop.java
+++ b/dx/src/com/android/dx/ssa/back/SsaToRop.java
@@ -174,7 +174,7 @@
for (SsaBasicBlock block : blocks) {
// Add moves in all the pred blocks for each phi insn.
- block.forEachPhiInsn(new PhiVisitor(block, blocks));
+ block.forEachPhiInsn(new PhiVisitor(blocks));
// Delete the phi insns.
block.removeAllPhiInsns();
@@ -194,12 +194,9 @@
* adding move instructions to predecessors based on phi insns.
*/
private static class PhiVisitor implements PhiInsn.Visitor {
- private final SsaBasicBlock block;
private final ArrayList<SsaBasicBlock> blocks;
- public PhiVisitor(SsaBasicBlock block,
- ArrayList<SsaBasicBlock> blocks) {
- this.block = block;
+ public PhiVisitor(ArrayList<SsaBasicBlock> blocks) {
this.blocks = blocks;
}
diff --git a/dx/src/com/android/dx/util/ByteArray.java b/dx/src/com/android/dx/util/ByteArray.java
index 9bc43a7..6bd6e5f 100644
--- a/dx/src/com/android/dx/util/ByteArray.java
+++ b/dx/src/com/android/dx/util/ByteArray.java
@@ -357,7 +357,7 @@
* simply so that the cursor of a wrapped {@link #MyInputStream}
* instance may be easily determined.
*/
- public class MyDataInputStream extends DataInputStream {
+ public static class MyDataInputStream extends DataInputStream {
/** {@code non-null;} the underlying {@link #MyInputStream} */
private final MyInputStream wrapped;