[Fb-contrib-commit] SF.net SVN: fb-contrib: [485] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2006-04-19 00:48:18
|
Revision: 485 Author: dbrosius Date: 2006-04-18 17:48:13 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=485&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java 2006-04-19 00:46:38 UTC (rev 484) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java 2006-04-19 00:48:13 UTC (rev 485) @@ -29,15 +29,14 @@ 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 calls to the wait method on mutexes defined in the java.util.concurrent package * where it is likely that await was intended. */ -public class SuspiciousWaitOnConcurrentObject extends BytecodeScanningDetector implements StatelessDetector { - +public class SuspiciousWaitOnConcurrentObject extends BytecodeScanningDetector +{ private static final Set<String> concurrentAwaitClasses = new HashSet<String>(); static { concurrentAwaitClasses.add("java.util.concurrent.CountDownLatch"); @@ -45,7 +44,7 @@ } private BugReporter bugReporter; - private OpcodeStack stack = new OpcodeStack(); + private OpcodeStack stack; /** * constructs a SWCO detector given the reporter to report bugs on @@ -54,28 +53,23 @@ public SuspiciousWaitOnConcurrentObject(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** - * clone this detector so that it can be a StatelessDetector - * - * @return a clone of this object - */ - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - /** * implements the visitor to check for class file version 1.5 or better * * @param classContext the context object of the currently parsed class */ @Override public void visitClassContext(ClassContext classContext) { - JavaClass cls = classContext.getJavaClass(); - int major = cls.getMajor(); - if (major >= Constants.MAJOR_1_5) { - super.visitClassContext(classContext); + try { + JavaClass cls = classContext.getJavaClass(); + int major = cls.getMajor(); + if (major >= Constants.MAJOR_1_5) { + stack = new OpcodeStack(); + super.visitClassContext(classContext); + } + } finally { + stack = null; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |