[Fb-contrib-commit] SF.net SVN: fb-contrib: [479] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-04-18 22:29:59
|
Revision: 479 Author: dbrosius Date: 2006-04-18 15:29:55 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=479&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2006-04-18 22:26:38 UTC (rev 478) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2006-04-18 22:29:55 UTC (rev 479) @@ -36,6 +36,7 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.SourceLineAnnotation; import edu.umd.cs.findbugs.StatelessDetector; +import edu.umd.cs.findbugs.ba.ClassContext; /** * looks for allocations of synchronized collections that are stored in local variables, and @@ -59,8 +60,8 @@ } private BugReporter bugReporter; - private OpcodeStack stack = new OpcodeStack(); - private Map<Integer, CollectionRegInfo> syncRegs = new HashMap<Integer, CollectionRegInfo>(); + private OpcodeStack stack; + private Map<Integer, CollectionRegInfo> syncRegs; /** * constructs a LSYC detector given the reporter to report bugs on * @param bugReporter the sync of bug reports @@ -70,15 +71,21 @@ } /** - * clone this detector so that it can be a StatelessDetector + * implements the visitor to create and clear the stack and syncRegs * - * @return a clone of this object + * @param classContext the context object of the currently parsed class */ @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - + public void visitClassContext(ClassContext classContext) { + try { + stack = new OpcodeStack(); + syncRegs = new HashMap<Integer, CollectionRegInfo>(); + super.visitClassContext(classContext); + } finally { + stack = null; + syncRegs = null; + } + } /** * implements the visitor to collect parameter registers * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |