[Fb-contrib-commit] SF.net SVN: fb-contrib: [483] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-04-19 00:44:43
|
Revision: 483 Author: dbrosius Date: 2006-04-18 17:44:32 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=483&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java 2006-04-19 00:43:01 UTC (rev 482) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java 2006-04-19 00:44:32 UTC (rev 483) @@ -25,7 +25,7 @@ import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.OpcodeStack; -import edu.umd.cs.findbugs.StatelessDetector; +import edu.umd.cs.findbugs.ba.ClassContext; /** * Looks for methods that call wait, notify or notifyAll on an instance of a @@ -34,10 +34,10 @@ * in question, and will cause spurious thread state changes, either waking threads up * when not intended, or removing the the thread from the runnable state. */ -public class SpuriousThreadStates extends BytecodeScanningDetector implements StatelessDetector +public class SpuriousThreadStates extends BytecodeScanningDetector { private BugReporter bugReporter; - private OpcodeStack stack = new OpcodeStack(); + private OpcodeStack stack; /** * constructs a STS detector given the reporter to report bugs on @@ -47,20 +47,22 @@ this.bugReporter = bugReporter; } - /** - * clone this detector so that it can be a StatelessDetector - * - * @return a clone of this object - */ - public Object clone() throws CloneNotSupportedException { - return super.clone(); + @Override + public void visitClassContext(ClassContext classContext) { + try { + stack = new OpcodeStack(); + super.visitClassContext(classContext); + } finally { + stack = null; + } } - + @Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); super.visitMethod(obj); } + @Override public void sawOpcode(int seen) { OpcodeStack.Item itm = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |