Revision: 457
Author: dbrosius
Date: 2006-04-16 20:44:46 -0700 (Sun, 16 Apr 2006)
ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=457&view=rev
Log Message:
-----------
Manually cleanup memory now that StatelessDetector is removed.
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2006-04-17 03:42:48 UTC (rev 456)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2006-04-17 03:44:46 UTC (rev 457)
@@ -29,7 +29,7 @@
import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugReporter;
import edu.umd.cs.findbugs.BytecodeScanningDetector;
-import edu.umd.cs.findbugs.StatelessDetector;
+import edu.umd.cs.findbugs.ba.ClassContext;
/**
* looks for methods that access arrays or classes that implement java.util.List
@@ -37,7 +37,8 @@
* variable, but if specific indices mean certain things, perhaps a first class object
* would be a better choice for a container.
*/
-public class ConstantListIndex extends BytecodeScanningDetector implements StatelessDetector {
+public class ConstantListIndex extends BytecodeScanningDetector
+{
private static final String MAX_ICONST0_LOOP_DISTANCE_PROPERTY = "fb-contrib.cli.maxloopdistance";
private static final int SEEN_NOTHING = 0;
private static final int SEEN_CONSTANT_0 = 1;
@@ -45,7 +46,7 @@
private BugReporter bugReporter;
private int state;
- private Set<Integer> iConst0Looped = new HashSet<Integer>();
+ private Set<Integer> iConst0Looped;
private int max_iConst0LoopDistance;
/**
@@ -56,15 +57,17 @@
this.bugReporter = bugReporter;
max_iConst0LoopDistance = Integer.getInteger(MAX_ICONST0_LOOP_DISTANCE_PROPERTY, 30).intValue();
}
-
+
/**
- * clone this detector so that it can be a StatelessDetector
+ * implements the visitor to create and clear the const0loop set
*
- * @return a clone of this object
+ * @param classContext the context object of the currently parsed class
*/
@Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
+ public void visitClassContext(ClassContext classContext) {
+ iConst0Looped = new HashSet<Integer>();
+ super.visitClassContext(classContext);
+ iConst0Looped = null;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|