Thread: [Fb-contrib-commit] SF.net SVN: fb-contrib: [446] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-04-15 00:36:37
|
Revision: 446 Author: dbrosius Date: 2006-04-14 17:36:31 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=446&view=rev Log Message: ----------- add copyright 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-15 00:35:47 UTC (rev 445) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java 2006-04-15 00:36:31 UTC (rev 446) @@ -1,3 +1,21 @@ +/* + * fb-contrib - Auxilliary detectors for Java programs + * Copyright (C) 2005-2006 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ package com.mebigfatguy.fbcontrib.detect; import java.util.HashSet; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |