[Fb-contrib-commit] SF.net SVN: fb-contrib: [480] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-04-19 00:39:46
|
Revision: 480 Author: dbrosius Date: 2006-04-18 17:39:41 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=480&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java 2006-04-18 22:29:55 UTC (rev 479) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java 2006-04-19 00:39:41 UTC (rev 480) @@ -28,13 +28,13 @@ 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 store the return result in a local variable, and * then immediately returns that local variable. */ -public class UnnecessaryStoreBeforeReturn extends BytecodeScanningDetector implements StatelessDetector +public class UnnecessaryStoreBeforeReturn extends BytecodeScanningDetector { private static final int SEEN_NOTHING = 0; private static final int SEEN_STORE = 1; @@ -62,7 +62,7 @@ } private BugReporter bugReporter; - private Set<Integer> branchTargets = new HashSet<Integer>(); + private Set<Integer> branchTargets; private int state; private int storeReg; @@ -75,15 +75,19 @@ } /** - * clone this detector so that it can be a StatelessDetector + * implements the visitor to create and clear the branchTargets * - * @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) { + try { + branchTargets = new HashSet<Integer>(); + super.visitClassContext(classContext); + } finally { + branchTargets = null; + } } - /** * implements the visitor to make sure method returns a value, and then clears the targets * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |