[Fb-contrib-commit] SF.net SVN: fb-contrib: [470] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2006-04-18 02:55:01
|
Revision: 470 Author: dbrosius Date: 2006-04-17 19:54:55 -0700 (Mon, 17 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=470&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2006-04-18 02:43:21 UTC (rev 469) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2006-04-18 02:54:55 UTC (rev 470) @@ -32,14 +32,14 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.FieldAnnotation; import edu.umd.cs.findbugs.OpcodeStack; -import edu.umd.cs.findbugs.StatelessDetector; +import edu.umd.cs.findbugs.ba.ClassContext; /** * looks for for loops that iterate over a java.util.List using an integer index, and get, * rather than using an Iterator. An iterator may perform better depending List implementation, * but more importantly will allow the code to be converted to other collections type. */ -public class ListIndexedIterating extends BytecodeScanningDetector implements StatelessDetector +public class ListIndexedIterating extends BytecodeScanningDetector { private static final int SEEN_NOTHING = 0; private static final int SEEN_IINC = 1; @@ -65,20 +65,22 @@ */ public ListIndexedIterating(final BugReporter bugReporter) { this.bugReporter = bugReporter; - stack = new OpcodeStack(); - possibleForLoops = new HashSet<ForLoop>(); } - + /** - * clone this detector so that it can be a StatelessDetector + * overrides the interface to create and clear the stack and loops tracker * - * @return a clone of this object + * @param classContext the context object for the currently parsed class */ @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); + public void visitClassContext(ClassContext classContext) { + stack = new OpcodeStack(); + possibleForLoops = new HashSet<ForLoop>(); + super.visitClassContext(classContext); + stack = null; + possibleForLoops = null; } - + /** * looks for methods that contain a GOTO or GOTO_W opcodes * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |