[Fb-contrib-commit] SF.net SVN: fb-contrib: [464] trunk/fb-contrib
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-04-17 15:43:30
|
Revision: 464 Author: dbrosius Date: 2006-04-17 08:43:17 -0700 (Mon, 17 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=464&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2006-04-17 15:40:42 UTC (rev 463) +++ trunk/fb-contrib/.classpath 2006-04-17 15:43:17 UTC (rev 464) @@ -3,8 +3,8 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="samples"/> - <classpathentry kind="lib" path="O:/fb-contrib/fb-contrib/lib/findbugs.jar"/> - <classpathentry kind="lib" path="O:/fb-contrib/fb-contrib/lib/bcel.jar"/> - <classpathentry kind="lib" path="O:/fb-contrib/fb-contrib/samples/lib/jsp-api.jar"/> + <classpathentry kind="lib" path="C:/fb-contrib/fb-contrib/lib/findbugs.jar"/> + <classpathentry kind="lib" path="C:/fb-contrib/fb-contrib/lib/bcel.jar"/> + <classpathentry kind="lib" path="C:/fb-contrib/fb-contrib/samples/lib/jsp-api.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2006-04-17 15:40:42 UTC (rev 463) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2006-04-17 15:43:17 UTC (rev 464) @@ -42,7 +42,6 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.FieldAnnotation; import edu.umd.cs.findbugs.SourceLineAnnotation; -import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.BasicBlock; import edu.umd.cs.findbugs.ba.CFG; import edu.umd.cs.findbugs.ba.ClassContext; @@ -53,14 +52,14 @@ * finds fields that are used in a locals only fashion, specifically private fields * that are accessed first in each method with a store vs. a load. */ -public class FieldCouldBeLocal extends BytecodeScanningDetector implements StatelessDetector { - +public class FieldCouldBeLocal extends BytecodeScanningDetector +{ private BugReporter bugReporter; private ClassContext clsContext; - private Map<String, FieldInfo> localizableFields = new HashMap<String, FieldInfo>(); + private Map<String, FieldInfo> localizableFields; private CFG cfg; private ConstantPoolGen cpg; - private BitSet visitedBlocks = new BitSet(); + private BitSet visitedBlocks; /** * constructs a FCBL detector given the reporter to report bugs on. @@ -72,17 +71,6 @@ } /** - * clone this detector so that it can be a StatelessDetector. - * - * @return a clone of this object - * @throws CloneNotSupportedException should not happen - */ - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - /** * overrides the visitor to collect localizable fields, and then report those that * survive all method checks. * @@ -90,7 +78,8 @@ */ @Override public void visitClassContext(ClassContext classContext) { - localizableFields.clear(); + localizableFields = new HashMap<String, FieldInfo>(); + visitedBlocks = new BitSet(); clsContext = classContext; JavaClass cls = classContext.getJavaClass(); Field[] fields = cls.getFields(); @@ -114,6 +103,9 @@ bugReporter.reportBug(bug); } } + localizableFields = null; + visitedBlocks = null; + clsContext = null; } /** @@ -140,6 +132,9 @@ catch (Exception e) { localizableFields.clear(); } + finally { + cfg = null; + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |