[Fb-contrib-commit] SF.net SVN: fb-contrib: [489] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-04-19 00:56:17
|
Revision: 489 Author: dbrosius Date: 2006-04-18 17:56:13 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=489&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2006-04-19 00:53:23 UTC (rev 488) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2006-04-19 00:56:13 UTC (rev 489) @@ -32,7 +32,6 @@ 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; /** @@ -41,7 +40,7 @@ * is made that this collection must be multithreaded safe. However, iterator access is used, * which is explicitly unsafe. When iterators are to be used, synchronization should be done manually. */ -public class SyncCollectionIterators extends BytecodeScanningDetector implements StatelessDetector +public class SyncCollectionIterators extends BytecodeScanningDetector { private BugReporter bugReporter; private static Set<String> synchCollectionNames = new HashSet<String>(); @@ -64,10 +63,10 @@ private static final int SEEN_LOAD = 2; private int state; - private Set<String> memberCollections = new HashSet<String>(); - private Set<Integer> localCollections = new HashSet<Integer>(); - private List<Object> monitorObjects = new ArrayList<Object>(); - private OpcodeStack stack = new OpcodeStack(); + private Set<String> memberCollections; + private Set<Integer> localCollections; + private List<Object> monitorObjects; + private OpcodeStack stack; private Object collectionInfo = null; /** @@ -78,20 +77,20 @@ 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(); - } - - @Override public void visitClassContext(final ClassContext classContext) { - memberCollections.clear(); - super.visitClassContext(classContext); + try { + memberCollections = new HashSet<String>(); + localCollections = new HashSet<Integer>(); + monitorObjects = new ArrayList<Object>(); + stack = new OpcodeStack(); + super.visitClassContext(classContext); + } finally { + memberCollections = null; + localCollections = null; + monitorObjects = null; + stack = null; + } } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |