Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21373/src/com/mebigfatguy/fbcontrib/detect
Modified Files:
ListIndexedIterating.java
Log Message:
if the for loop is limited by a constant, don't report LII
Index: ListIndexedIterating.java
===================================================================
RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- ListIndexedIterating.java 14 Oct 2005 03:31:00 -0000 1.6
+++ ListIndexedIterating.java 18 Oct 2005 04:06:46 -0000 1.7
@@ -144,6 +144,13 @@
continue;
}
if (seen == IF_ICMPGE) {
+ if (stack.getStackDepth() > 1) {
+ OpcodeStack.Item itm = stack.getStackItem(0);
+ if (itm.getConstant() != null) {
+ it.remove();
+ continue;
+ }
+ }
int branchTarget = getBranchTarget();
if ((branchTarget >= (fl.getLoopEnd() + 3)) && (branchTarget <= (fl.getLoopEnd() + 5))) {
fl.setLoopState(LOOP_IN_BODY);
|