Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32132/src/com/mebigfatguy/fbcontrib/detect
Modified Files:
ParallelLists.java
Log Message:
add support for array loading, fix some sillyness
Index: ParallelLists.java
===================================================================
RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ParallelLists.java 25 Sep 2005 04:49:53 -0000 1.2
+++ ParallelLists.java 25 Sep 2005 05:46:46 -0000 1.3
@@ -62,7 +62,7 @@
if (sig.startsWith("java/util/") && sig.endsWith("List")) {
listFields.add(f.getName());
}
- } else if (sig.charAt(0) == '[')
+ } else if ((sig.charAt(0) == '[') && (sig.charAt(1) != '['))
listFields.add(f.getName());
}
@@ -86,35 +86,41 @@
if ("java/util/List".equals(className)
&& "get".equals(methodName)
&& "(I)Ljava/lang/Object;".equals(methodSig)) {
- if (stack.getStackDepth() > 2) {
- OpcodeStack.Item index = stack.getStackItem(0);
- OpcodeStack.Item list =stack.getStackItem(1);
-
- int indexReg = index.getRegisterNumber();
- FieldAnnotation fa = list.getField();
-
- if ((indexReg >= 0) && (fa != null)) {
- if (listFields.contains(fa.getFieldName())) {
- String f = indexToFieldMap.get(new Integer(indexReg));
- if (f != null) {
- bugReporter.reportBug( new BugInstance( this, "PL_PARALLEL_LISTS", NORMAL_PRIORITY)
- .addClass(this)
- .addMethod(this)
- .addSourceLine(this, getPC()));
- }
- listFields.remove(fa.getFieldName());
- indexToFieldMap.clear();
- }
- else
- indexToFieldMap.put(new Integer(indexReg), fa.getFieldName());
- }
- }
+ checkParms();
}
} else if ((seen >= IFEQ) && (seen <= RETURN)) {
indexToFieldMap.clear();
+ } else if ((seen >= IALOAD) && (seen <= SALOAD)) {
+ checkParms();
}
} finally {
stack.sawOpcode(this, seen);
}
}
+
+ private void checkParms() {
+ if (stack.getStackDepth() >= 2) {
+ OpcodeStack.Item index = stack.getStackItem(0);
+ OpcodeStack.Item list =stack.getStackItem(1);
+
+ int indexReg = index.getRegisterNumber();
+ FieldAnnotation fa = list.getField();
+
+ if ((indexReg >= 0) && (fa != null)) {
+ if (listFields.contains(fa.getFieldName())) {
+ String f = indexToFieldMap.get(new Integer(indexReg));
+ if ((f != null) && (!f.equals(fa.getFieldName()))) {
+ bugReporter.reportBug( new BugInstance( this, "PL_PARALLEL_LISTS", NORMAL_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this, getPC()));
+ listFields.remove(fa.getFieldName());
+ indexToFieldMap.clear();
+ }
+ else
+ indexToFieldMap.put(new Integer(indexReg), fa.getFieldName());
+ }
+ }
+ }
+ }
}
|