[Fb-contrib-commit] SF.net SVN: fb-contrib: [542] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/uti
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-05-17 05:11:14
|
Revision: 542 Author: dbrosius Date: 2006-05-16 22:10:55 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=542&view=rev Log Message: ----------- use Integer14.valueOf Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/Integer14.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2006-05-17 05:10:55 UTC (rev 542) @@ -27,6 +27,7 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -123,7 +124,7 @@ OpcodeStack.Item itm = stack.getStackItem(0); Integer size = (Integer)itm.getConstant(); if ((size != null) && (size.intValue() == 1)) { - userValue = new Integer(-1); + userValue = Integer14.valueOf(-1); } } } else if ((seen >= IASTORE) && (seen <= SASTORE)) { @@ -131,7 +132,7 @@ OpcodeStack.Item itm = stack.getStackItem(2); int reg = itm.getRegisterNumber(); if (reg != -1) { - WrapperInfo wi = wrappers.get(new Integer(reg)); + WrapperInfo wi = wrappers.get(Integer14.valueOf(reg)); if (wi != null) { OpcodeStack.Item elItm = stack.getStackItem(0); wi.wrappedReg = elItm.getRegisterNumber(); @@ -139,7 +140,7 @@ } else { OpcodeStack.Item elItm = stack.getStackItem(0); if (elItm.getRegisterNumber() != -1) - userValue = new Integer(elItm.getRegisterNumber()); + userValue = Integer14.valueOf(elItm.getRegisterNumber()); } } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { @@ -150,7 +151,7 @@ int reg = RegisterUtils.getAStoreReg(this, seen); Integer elReg = (Integer)itm.getUserValue(); if (elReg != null) - wrappers.put(new Integer(reg), new WrapperInfo(elReg.intValue())); + wrappers.put(Integer14.valueOf(reg), new WrapperInfo(elReg.intValue())); } else { Integer elReg = (Integer)itm.getUserValue(); if (elReg != null) { @@ -177,7 +178,7 @@ if ((argSig.length() > 0) && (argSig.charAt(0) == '[')) { OpcodeStack.Item itm = stack.getStackItem(args.length - i - 1); int arrayReg = itm.getRegisterNumber(); - WrapperInfo wi = wrappers.get(new Integer(arrayReg)); + WrapperInfo wi = wrappers.get(Integer14.valueOf(arrayReg)); if (wi != null) wi.wasArg = true; } @@ -187,16 +188,16 @@ if (stack.getStackDepth() >= 2) { OpcodeStack.Item arItm = stack.getStackItem(1); int arReg = arItm.getRegisterNumber(); - WrapperInfo wi = wrappers.get(new Integer(arReg)); + WrapperInfo wi = wrappers.get(Integer14.valueOf(arReg)); if ((wi != null) && wi.wasArg) { - userValue = new Integer(wi.wrappedReg); + userValue = Integer14.valueOf(wi.wrappedReg); } } } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { int reg = RegisterUtils.getALoadReg(this, seen); - WrapperInfo wi = wrappers.get(new Integer(reg)); + WrapperInfo wi = wrappers.get(Integer14.valueOf(reg)); if (wi != null) - userValue = new Integer(wi.wrappedReg); + userValue = Integer14.valueOf(wi.wrappedReg); } else if (((seen == ISTORE) || ((seen >= ISTORE_0) && (seen <= ISTORE_3))) || ((seen == LSTORE) || ((seen >= LSTORE_0) && (seen <= LSTORE_3))) || ((seen == DSTORE) || ((seen >= DSTORE_0) && (seen <= DSTORE_3))) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2006-05-17 05:10:55 UTC (rev 542) @@ -29,6 +29,7 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -104,7 +105,7 @@ syncPC = -1; isStatic = m.isStatic(); unsafeAliases.clear(); - unsafeAliases.add(new Integer(0)); + unsafeAliases.add(Integer14.valueOf(0)); branchInfo.clear(); unsafeCallOccurred = false; stack.resetForMethodEntry(this); @@ -124,7 +125,7 @@ if (unsafeCallOccurred && ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3)))) { int storeReg = RegisterUtils.getAStoreReg(this, seen); if (storeReg >= 0) - unsafeAliases.add(new Integer(storeReg)); + unsafeAliases.add(Integer14.valueOf(storeReg)); } if ((seen == INVOKEVIRTUAL) @@ -136,7 +137,7 @@ int parmCount = Type.getArgumentTypes(methodSig).length; if (stack.getStackDepth() > parmCount) { OpcodeStack.Item itm = stack.getStackItem(parmCount); - unsafeCallOccurred = unsafeAliases.contains(new Integer(itm.getRegisterNumber())); + unsafeCallOccurred = unsafeAliases.contains(Integer14.valueOf(itm.getRegisterNumber())); } else unsafeCallOccurred = false; } else @@ -145,8 +146,8 @@ unsafeCallOccurred = (getDottedClassConstantOperand().equals(this.getClassContext().getJavaClass().getClassName())); else if ((seen >= IFEQ) && (seen <= GOTO)) { - Integer from = new Integer(getPC()); - Integer to = new Integer(getBranchTarget()); + Integer from = Integer14.valueOf(getPC()); + Integer to = Integer14.valueOf(getBranchTarget()); branchInfo.put(from, to); unsafeCallOccurred = false; } @@ -160,7 +161,7 @@ OpcodeStack.Item itm = stack.getStackItem(0); int monitorReg = itm.getRegisterNumber(); if (monitorReg >= 0) { - unsafeAliases.add(new Integer(monitorReg)); + unsafeAliases.add(Integer14.valueOf(monitorReg)); } } } @@ -173,7 +174,7 @@ unsafe |= ((seen == PUTFIELD) || (seen == GETFIELD) || (seen == GETSTATIC) || (seen == PUTSTATIC)); unsafe |= (!isStatic) && ((seen == ALOAD_0) || (seen == ASTORE_0)); int aloadReg = RegisterUtils.getALoadReg(this, seen); - unsafe |= (aloadReg >= 0) && unsafeAliases.contains(new Integer(aloadReg)); + unsafe |= (aloadReg >= 0) && unsafeAliases.contains(Integer14.valueOf(aloadReg)); if (unsafe) { //If a branch exists in the safe code, make sure the entire branch //is in the safe code, otherwise trim before the branch Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2006-05-17 05:10:55 UTC (rev 542) @@ -32,6 +32,8 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -280,13 +282,13 @@ private void addLineNumber(Set<Integer> lineNumbers) { LineNumberTable lnt = getCode().getLineNumberTable(); if (lnt == null) - lineNumbers.add(new Integer(-lineNumbers.size())); + lineNumbers.add(Integer14.valueOf(-lineNumbers.size())); else { int line = lnt.getSourceLine(getPC()); if (line < 0) - lineNumbers.add(new Integer(lineNumbers.size())); + lineNumbers.add(Integer14.valueOf(lineNumbers.size())); else { - lineNumbers.add(new Integer(line)); + lineNumbers.add(Integer14.valueOf(line)); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2006-05-17 05:10:55 UTC (rev 542) @@ -26,6 +26,8 @@ import org.apache.bcel.classfile.ConstantInteger; import org.apache.bcel.classfile.Method; +import com.mebigfatguy.fbcontrib.utils.Integer14; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -120,7 +122,7 @@ //case CALOAD: usually harmless so ignore case SALOAD: if (state == SEEN_CONSTANT_0) - iConst0Looped.add(new Integer(getPC())); + iConst0Looped.add(Integer14.valueOf(getPC())); else { bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) .addClass(this) @@ -134,7 +136,7 @@ String methodName = getNameConstantOperand(); if ("get".equals(methodName)) { if (state == SEEN_CONSTANT_0) - iConst0Looped.add(new Integer(getPC())); + iConst0Looped.add(Integer14.valueOf(getPC())); else { bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) .addClass(this) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2006-05-17 05:10:55 UTC (rev 542) @@ -25,6 +25,8 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.Method; +import com.mebigfatguy.fbcontrib.utils.Integer14; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.Detector; @@ -112,7 +114,7 @@ && (edgeType != EdgeTypes.UNKNOWN_EDGE)) { if ((edgeType == EdgeTypes.UNHANDLED_EXCEPTION_EDGE) || (edgeType == EdgeTypes.HANDLED_EXCEPTION_EDGE)) { - Integer nodeTarget = new Integer(e.getTarget().getId()); + Integer nodeTarget = Integer14.valueOf(e.getTarget().getId()); if (!exceptionNodeTargets.contains(nodeTarget)) { exceptionNodeTargets.add(nodeTarget); branches++; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2006-05-17 05:10:55 UTC (rev 542) @@ -33,6 +33,7 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -188,7 +189,7 @@ BugInstance bi = null; for (int i = 0; i < parmCount; i++) { - if (changedParms.remove(new Integer(i))) + if (changedParms.remove(Integer14.valueOf(i))) continue; int reg; @@ -220,7 +221,7 @@ if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { int parm = getAStoreParameter(seen); if (parm >= 0) - changedParms.add(new Integer(parm)); + changedParms.add(Integer14.valueOf(parm)); } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2006-05-17 05:10:55 UTC (rev 542) @@ -25,6 +25,7 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -74,8 +75,8 @@ for (int t = 0; t < argTypes.length; t++) { String sig = argTypes[t].getSignature(); if (isJDBCClass(sig)) { - jdbcLocals.put(new Integer(parmRegs[t]), - new Integer(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), parmRegs[t], 0))); + jdbcLocals.put(Integer14.valueOf(parmRegs[t]), + Integer14.valueOf(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), parmRegs[t], 0))); } } } @@ -126,13 +127,13 @@ OpcodeStack.Item itm = stack.getStackItem(0); if (itm.getUserValue() != null) { int reg = RegisterUtils.getAStoreReg(this, seen); - jdbcLocals.put(new Integer(reg), new Integer(RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC()))); + jdbcLocals.put(Integer14.valueOf(reg), Integer14.valueOf(RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC()))); } } } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { int reg = RegisterUtils.getALoadReg(this, seen); - if (jdbcLocals.containsKey(new Integer(reg))) + if (jdbcLocals.containsKey(Integer14.valueOf(reg))) tosIsJDBC = true; } } finally { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2006-05-17 05:10:55 UTC (rev 542) @@ -28,6 +28,7 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -96,7 +97,7 @@ syncRegs.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(obj); for (int pr : parmRegs) { - syncRegs.put(new Integer(pr), + syncRegs.put(Integer14.valueOf(pr), new CollectionRegInfo(RegisterUtils.getLocalVariableEndRange(obj.getLocalVariableTable(), pr, 0))); } } @@ -137,13 +138,13 @@ if (seen == INVOKESPECIAL) { if ("<init>".equals(getNameConstantOperand())) { if (syncCtors.contains(getClassConstantOperand())) { - tosIsSyncColReg = new Integer(-1); + tosIsSyncColReg = Integer14.valueOf(-1); } } } else if (seen == INVOKESTATIC) { if ("java/util/Collections".equals(getClassConstantOperand())) { if (syncMethods.contains(getNameConstantOperand())) { - tosIsSyncColReg = new Integer(-1); + tosIsSyncColReg = Integer14.valueOf(-1); } } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { @@ -151,25 +152,25 @@ OpcodeStack.Item item = stack.getStackItem(0); int reg = RegisterUtils.getAStoreReg(this, seen); if (item.getUserValue() != null) { - if (!syncRegs.containsKey(new Integer(reg))) { + if (!syncRegs.containsKey(Integer14.valueOf(reg))) { CollectionRegInfo cri = new CollectionRegInfo(SourceLineAnnotation.fromVisitedInstruction(this), RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC())); - syncRegs.put(new Integer(reg), cri); + syncRegs.put(Integer14.valueOf(reg), cri); } } else { - CollectionRegInfo cri = syncRegs.get(new Integer(reg)); + CollectionRegInfo cri = syncRegs.get(Integer14.valueOf(reg)); if (cri == null) { cri = new CollectionRegInfo(RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC())); - syncRegs.put(new Integer(reg), cri); + syncRegs.put(Integer14.valueOf(reg), cri); } cri.setIgnore(); } } } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { int reg = RegisterUtils.getALoadReg(this, seen); - CollectionRegInfo cri = syncRegs.get(new Integer(reg)); + CollectionRegInfo cri = syncRegs.get(Integer14.valueOf(reg)); if ((cri != null) && !cri.getIgnore()) - tosIsSyncColReg = new Integer(reg); + tosIsSyncColReg = Integer14.valueOf(reg); } else if ((seen == PUTFIELD) || (seen == ARETURN)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2006-05-17 05:10:55 UTC (rev 542) @@ -9,6 +9,7 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -26,9 +27,9 @@ */ public class NonOwnedSynchronization extends BytecodeScanningDetector { - private static final Integer OWNED = new Integer(Integer.MAX_VALUE); - private static final Integer LOW = new Integer(LOW_PRIORITY); - private static final Integer NORMAL = new Integer(NORMAL_PRIORITY); + private static final Integer OWNED = Integer14.valueOf(Integer.MAX_VALUE); + private static final Integer LOW = Integer14.valueOf(LOW_PRIORITY); + private static final Integer NORMAL = Integer14.valueOf(NORMAL_PRIORITY); private BugReporter bugReporter; private OpcodeStack stack; private Map<Integer, Integer> regPriorities; @@ -79,9 +80,9 @@ regPriorities.clear(); int[] parmRegs = RegisterUtils.getParameterRegisters(method); for (int reg : parmRegs) - regPriorities.put(new Integer(reg), NORMAL); + regPriorities.put(Integer14.valueOf(reg), NORMAL); if (!method.isStatic()) - regPriorities.put(new Integer(0), LOW); + regPriorities.put(Integer14.valueOf(0), LOW); super.visitCode(obj); } } @@ -110,7 +111,7 @@ if (getMethod().isStatic() && (reg == 0)) tosIsPriority = LOW; else { - tosIsPriority = regPriorities.get(new Integer(reg)); + tosIsPriority = regPriorities.get(Integer14.valueOf(reg)); if (tosIsPriority == null) tosIsPriority = NORMAL; } @@ -125,7 +126,7 @@ if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); Integer priority = (Integer)item.getUserValue(); - regPriorities.put(new Integer(RegisterUtils.getAStoreReg(this, seen)), priority); + regPriorities.put(Integer14.valueOf(RegisterUtils.getAStoreReg(this, seen)), priority); } } break; @@ -144,7 +145,7 @@ } else { int reg = itm.getRegisterNumber(); if (reg > 0) - tosIsPriority = regPriorities.get(new Integer(reg)); + tosIsPriority = regPriorities.get(Integer14.valueOf(reg)); else tosIsPriority = OWNED; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2006-05-17 05:10:55 UTC (rev 542) @@ -26,6 +26,8 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -134,7 +136,7 @@ if ("org/w3c/dom/Document".equals(className)) { if (domCreationMethods.contains(methodInfo)) { sawCreate = true; - itemPC = new Integer(getPC()); + itemPC = Integer14.valueOf(getPC()); } } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && seen <= ASTORE_3)) { @@ -145,9 +147,9 @@ else reg = seen - ASTORE_0; if (pc != null) - nodeStores.put(new Integer(reg), pc); + nodeStores.put(Integer14.valueOf(reg), pc); else - nodeStores.remove(new Integer(reg)); + nodeStores.remove(Integer14.valueOf(reg)); } else if (seen == PUTFIELD) { //Stores to member variables are assumed ok findDOMNodeCreationPoint(0); @@ -157,7 +159,7 @@ reg = getRegisterOperand(); else reg = seen - ALOAD_0; - itemPC = nodeStores.get(new Integer(reg)); + itemPC = nodeStores.get(Integer14.valueOf(reg)); if (itemPC != null) sawCreate = true; } else if (seen == ARETURN) { @@ -165,7 +167,7 @@ OpcodeStack.Item itm = stack.getStackItem(0); int reg = itm.getRegisterNumber(); nodeCreations.remove(itm); - nodeStores.remove(new Integer(reg)); + nodeStores.remove(Integer14.valueOf(reg)); } } @@ -182,7 +184,7 @@ if (nodeCreations.containsKey(itm)) { int reg = itm.getRegisterNumber(); nodeCreations.remove(itm); - nodeStores.remove(new Integer(reg)); + nodeStores.remove(Integer14.valueOf(reg)); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2006-05-17 05:10:55 UTC (rev 542) @@ -35,6 +35,8 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -189,7 +191,7 @@ if (!methodIsStatic) parm--; if ((parm >= 0) && (parm < parmCount)) - parameterDefiners.remove(new Integer(reg)); + parameterDefiners.remove(Integer14.valueOf(reg)); } else { parameterDefiners.clear(); } @@ -202,7 +204,7 @@ if (!methodIsStatic) parm--; if ((parm >= 0) && (parm < parmCount)) - parameterDefiners.remove(new Integer(reg)); + parameterDefiners.remove(Integer14.valueOf(reg)); } else { parameterDefiners.clear(); } @@ -218,7 +220,7 @@ if (!methodIsStatic) parm--; if ((parm >= 0) && (parm < parmCount)) - usedParameters.add(new Integer(reg)); + usedParameters.add(Integer14.valueOf(reg)); } } finally { stack.sawOpcode(this, seen); @@ -281,7 +283,7 @@ Map<JavaClass, List<String>> definers = getClassDefiners(cls); if (definers.size() > 0) { - parameterDefiners.put( new Integer(i + (methodIsStatic ? 0 : 1)), definers ); + parameterDefiners.put( Integer14.valueOf(i + (methodIsStatic ? 0 : 1)), definers ); hasPossiblyOverlyConcreteParm = true; } } @@ -323,7 +325,7 @@ String methodName = getNameConstantOperand(); String methodInfo = methodName + methodSig; - Map<JavaClass, List<String>> definers = parameterDefiners.get(new Integer(reg)); + Map<JavaClass, List<String>> definers = parameterDefiners.get(Integer14.valueOf(reg)); if ((definers != null) && (definers.size() > 0)) { Iterator<List<String>> it = definers.values().iterator(); while (it.hasNext()) { @@ -340,7 +342,7 @@ it.remove(); } if (definers.size() == 0) { - parameterDefiners.remove(new Integer(reg)); + parameterDefiners.remove(Integer14.valueOf(reg)); } } } @@ -349,11 +351,11 @@ if (parmSig.startsWith("L")) { parmSig = parmSig.substring( 1, parmSig.length() - 1).replace('/', '.'); if ("java.lang.Object".equals(parmSig)) { - parameterDefiners.remove(new Integer(reg)); + parameterDefiners.remove(Integer14.valueOf(reg)); return; } - Map<JavaClass, List<String>> definers = parameterDefiners.get(new Integer(reg)); + Map<JavaClass, List<String>> definers = parameterDefiners.get(Integer14.valueOf(reg)); if ((definers != null) && (definers.size() > 0)) { Iterator<JavaClass> it = definers.keySet().iterator(); while (it.hasNext()) { @@ -363,7 +365,7 @@ } if (definers.size() == 0) - parameterDefiners.remove(new Integer(reg)); + parameterDefiners.remove(Integer14.valueOf(reg)); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2006-05-17 05:10:55 UTC (rev 542) @@ -27,6 +27,8 @@ import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.JavaClass; +import com.mebigfatguy.fbcontrib.utils.Integer14; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -109,7 +111,7 @@ indexToFieldMap.clear(); } else if ((seen == ISTORE) || (seen == IINC) || ((seen >= ISTORE_0) && (seen <= ISTORE_3))) { int reg = getIntOpRegister(seen); - indexToFieldMap.remove(new Integer(reg)); + indexToFieldMap.remove(Integer14.valueOf(reg)); } else if ((seen >= IALOAD) && (seen <= SALOAD)) { checkParms(); } @@ -134,7 +136,7 @@ if ((indexReg >= 0) && (fa != null)) { if (listFields.contains(fa.getFieldName())) { - String f = indexToFieldMap.get(new Integer(indexReg)); + String f = indexToFieldMap.get(Integer14.valueOf(indexReg)); if ((f != null) && (!f.equals(fa.getFieldName()))) { bugReporter.reportBug( new BugInstance( this, "PL_PARALLEL_LISTS", NORMAL_PRIORITY) .addClass(this) @@ -144,7 +146,7 @@ indexToFieldMap.clear(); } else - indexToFieldMap.put(new Integer(indexReg), fa.getFieldName()); + indexToFieldMap.put(Integer14.valueOf(indexReg), fa.getFieldName()); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2006-05-17 05:10:55 UTC (rev 542) @@ -25,6 +25,8 @@ import org.apache.bcel.classfile.Code; +import com.mebigfatguy.fbcontrib.utils.Integer14; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -113,7 +115,7 @@ String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) - queryLocations.add(new Integer(getPC())); + queryLocations.add(Integer14.valueOf(getPC())); } else if ((seen == GOTO) || (seen == GOTO_W)) { int branchTarget = getBranchTarget(); int pc = getPC(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2006-05-17 05:10:55 UTC (rev 542) @@ -29,6 +29,7 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -170,7 +171,7 @@ OpcodeStack.Item item = stack.getStackItem(0); if ("Ljavax/swing/JLabel;".equals(item.getSignature())) { int reg = RegisterUtils.getAStoreReg(this, seen); - localLabels.put(new Integer(reg), SourceLineAnnotation.fromVisitedInstruction(this)); + localLabels.put(Integer14.valueOf(reg), SourceLineAnnotation.fromVisitedInstruction(this)); } } } else if (seen == INVOKEVIRTUAL) { @@ -198,7 +199,7 @@ else { int reg = item.getRegisterNumber(); if (reg >= 0) { - localLabels.remove(new Integer(reg)); + localLabels.remove(Integer14.valueOf(reg)); } } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2006-05-17 05:10:55 UTC (rev 542) @@ -27,6 +27,8 @@ import org.apache.bcel.classfile.ConstantFieldref; import org.apache.bcel.classfile.ConstantNameAndType; +import com.mebigfatguy.fbcontrib.utils.Integer14; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -117,14 +119,14 @@ } } else if (seen == ALOAD) { int reg = getRegisterOperand(); - if (localCollections.contains(new Integer(reg))) { - collectionInfo = new Integer(reg); + if (localCollections.contains(Integer14.valueOf(reg))) { + collectionInfo = Integer14.valueOf(reg); state = SEEN_LOAD; } } else if ((seen >= ALOAD_0) && (seen <= ALOAD_3)) { int reg = seen - ALOAD_0; - if (localCollections.contains(new Integer(reg))) { - collectionInfo = new Integer(reg); + if (localCollections.contains(Integer14.valueOf(reg))) { + collectionInfo = Integer14.valueOf(reg); state = SEEN_LOAD; } } else if (seen == GETFIELD) { @@ -142,10 +144,10 @@ case SEEN_SYNC: if (seen == ASTORE) { int reg = getRegisterOperand(); - localCollections.add(new Integer(reg)); + localCollections.add(Integer14.valueOf(reg)); } else if ((seen >= ASTORE_0) && (seen <= ASTORE_3)) { int reg = seen - ASTORE_0; - localCollections.add(new Integer(reg)); + localCollections.add(Integer14.valueOf(reg)); } else if (seen == PUTFIELD) { ConstantFieldref ref = (ConstantFieldref)getConstantRefOperand(); @@ -198,7 +200,7 @@ OpcodeStack.Item item = stack.getStackItem(0); int reg = item.getRegisterNumber(); if (reg >= 0) - monitorObjects.add(new Integer(reg)); + monitorObjects.add(Integer14.valueOf(reg)); else { FieldAnnotation fa = item.getField(); if (fa != null) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java 2006-05-17 05:10:55 UTC (rev 542) @@ -25,6 +25,8 @@ import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; +import com.mebigfatguy.fbcontrib.utils.Integer14; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -41,24 +43,24 @@ private static final int SEEN_LOAD = 2; private static final Set<Integer> branchInstructions = new HashSet<Integer>(); static { - branchInstructions.add(new Integer(GOTO)); - branchInstructions.add(new Integer(GOTO_W)); - branchInstructions.add(new Integer(IFEQ)); - branchInstructions.add(new Integer(IFNE)); - branchInstructions.add(new Integer(IFLT)); - branchInstructions.add(new Integer(IFGE)); - branchInstructions.add(new Integer(IFGT)); - branchInstructions.add(new Integer(IFLE)); - branchInstructions.add(new Integer(IF_ICMPEQ)); - branchInstructions.add(new Integer(IF_ICMPNE)); - branchInstructions.add(new Integer(IF_ICMPLT)); - branchInstructions.add(new Integer(IF_ICMPGE)); - branchInstructions.add(new Integer(IF_ICMPGT)); - branchInstructions.add(new Integer(IF_ICMPLE)); - branchInstructions.add(new Integer(IF_ACMPEQ)); - branchInstructions.add(new Integer(IF_ACMPNE)); - branchInstructions.add(new Integer(IFNULL)); - branchInstructions.add(new Integer(IFNONNULL)); + branchInstructions.add(Integer14.valueOf(GOTO)); + branchInstructions.add(Integer14.valueOf(GOTO_W)); + branchInstructions.add(Integer14.valueOf(IFEQ)); + branchInstructions.add(Integer14.valueOf(IFNE)); + branchInstructions.add(Integer14.valueOf(IFLT)); + branchInstructions.add(Integer14.valueOf(IFGE)); + branchInstructions.add(Integer14.valueOf(IFGT)); + branchInstructions.add(Integer14.valueOf(IFLE)); + branchInstructions.add(Integer14.valueOf(IF_ICMPEQ)); + branchInstructions.add(Integer14.valueOf(IF_ICMPNE)); + branchInstructions.add(Integer14.valueOf(IF_ICMPLT)); + branchInstructions.add(Integer14.valueOf(IF_ICMPGE)); + branchInstructions.add(Integer14.valueOf(IF_ICMPGT)); + branchInstructions.add(Integer14.valueOf(IF_ICMPLE)); + branchInstructions.add(Integer14.valueOf(IF_ACMPEQ)); + branchInstructions.add(Integer14.valueOf(IF_ACMPNE)); + branchInstructions.add(Integer14.valueOf(IFNULL)); + branchInstructions.add(Integer14.valueOf(IFNONNULL)); } private BugReporter bugReporter; @@ -120,7 +122,7 @@ break; case SEEN_STORE: - if (branchTargets.contains(new Integer(getPC()))) { + if (branchTargets.contains(Integer14.valueOf(getPC()))) { state = SEEN_NOTHING; return; } @@ -139,8 +141,8 @@ break; } - if (branchInstructions.contains(new Integer(seen))) { - branchTargets.add(new Integer(getBranchTarget())); + if (branchInstructions.contains(Integer14.valueOf(seen))) { + branchTargets.add(Integer14.valueOf(getBranchTarget())); } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java 2006-05-17 05:10:55 UTC (rev 542) @@ -27,6 +27,7 @@ import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -111,7 +112,7 @@ try { stack.mergeJumps(this); - Set<Integer> regs = localScopeEnds.remove(new Integer(getPC())); + Set<Integer> regs = localScopeEnds.remove(Integer14.valueOf(getPC())); if (regs != null) { for (Integer i : regs) { localCollections.remove(i); @@ -156,26 +157,26 @@ throws ClassNotFoundException { int reg = colItm.getRegisterNumber(); if (reg != -1) { - Set<SourceLineAnnotation> pcs = localSourceLineAnnotations.get(new Integer(reg)); + Set<SourceLineAnnotation> pcs = localSourceLineAnnotations.get(Integer14.valueOf(reg)); if (pcs == null) { pcs = new HashSet<SourceLineAnnotation>(); - localSourceLineAnnotations.put(new Integer(reg), pcs); + localSourceLineAnnotations.put(Integer14.valueOf(reg), pcs); } pcs.add(SourceLineAnnotation.fromVisitedInstruction(this, getPC())); - Set<String> commonSupers = localCollections.get(new Integer(reg)); + Set<String> commonSupers = localCollections.get(Integer14.valueOf(reg)); if (commonSupers != null) mergeItem(commonSupers, pcs, addItm); else { commonSupers = new HashSet<String>(); - localCollections.put(new Integer(reg), commonSupers); + localCollections.put(Integer14.valueOf(reg), commonSupers); addNewItem(commonSupers, addItm); - Integer scopeEnd = new Integer(RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC())); + Integer scopeEnd = Integer14.valueOf(RegisterUtils.getLocalVariableEndRange(getMethod().getLocalVariableTable(), reg, getNextPC())); Set<Integer> regs = localScopeEnds.get(scopeEnd); if (regs == null) { regs = new HashSet<Integer>(); localScopeEnds.put(scopeEnd, regs); } - regs.add(new Integer(reg)); + regs.add(Integer14.valueOf(reg)); } } else { FieldAnnotation fa = colItm.getField(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/Integer14.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/Integer14.java 2006-05-17 05:03:21 UTC (rev 541) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/Integer14.java 2006-05-17 05:10:55 UTC (rev 542) @@ -20,8 +20,8 @@ public class Integer14 { - public static final int MIN_CACHE = -32; - public static final int MAX_CACHE = 32; + public static final int MIN_CACHE = -10; + public static final int MAX_CACHE = 256; private static final Integer[] cachedInts = new Integer[MAX_CACHE-MIN_CACHE+1]; static { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |