[Fb-contrib-commit] fb-contrib/src/com/mebigfatguy/fbcontrib/detect ListIndexedIterating.java,1.3,1.
Brought to you by:
dbrosius
|
From: Dave B. <dbr...@us...> - 2005-10-12 04:26:29
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24527/src/com/mebigfatguy/fbcontrib/detect Modified Files: ListIndexedIterating.java Log Message: don't report LII when the for loop does not start with 0 Index: ListIndexedIterating.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ListIndexedIterating.java 1 Oct 2005 07:38:02 -0000 1.3 +++ ListIndexedIterating.java 12 Oct 2005 04:26:21 -0000 1.4 @@ -24,6 +24,8 @@ import org.apache.bcel.classfile.Code; +import sun.security.krb5.internal.crypto.n; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -173,8 +175,14 @@ && "get".equals(getNameConstantOperand()) && "(I)Ljava/lang/Object;".equals(getSigConstantOperand()))) { it.remove(); - } else + } else { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item itm = stack.getStackItem(0); + if (((Integer) itm.getConstant()).intValue() != 0) + it.remove(); + } fl.setLoopRegLoaded(false); + } } break; } |