[Fb-contrib-commit] SF.net SVN: fb-contrib: [482] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-04-19 00:43:59
|
Revision: 482 Author: dbrosius Date: 2006-04-18 17:43:01 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=482&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java 2006-04-19 00:42:04 UTC (rev 481) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java 2006-04-19 00:43:01 UTC (rev 482) @@ -32,7 +32,6 @@ import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; -import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; /** @@ -42,7 +41,8 @@ * as obfuscation. Use of Class.forName should only be used when the class in question * isn't already statically bound to this context. */ -public class SloppyClassReflection extends BytecodeScanningDetector implements StatelessDetector { +public class SloppyClassReflection extends BytecodeScanningDetector +{ private static final int COLLECT = -1; private static final int SEEN_NOTHING = 0; private static final int SEEN_LDC = 1; @@ -60,30 +60,24 @@ public SloppyClassReflection(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** - * clone this detector so that it can be a StatelessDetector - * - * @return a clone of this object - */ - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - /** * overrides the visitor to collect all class references * * @param classContext the class context of the currently visited class */ @Override public void visitClassContext(ClassContext classContext) { - refClasses = new HashSet<String>(); - refClasses.add(classContext.getJavaClass().getClassName()); - state = COLLECT; - super.visitClassContext(classContext); - state = SEEN_NOTHING; - super.visitClassContext(classContext); - refClasses = null; + try { + refClasses = new HashSet<String>(); + refClasses.add(classContext.getJavaClass().getClassName()); + state = COLLECT; + super.visitClassContext(classContext); + state = SEEN_NOTHING; + super.visitClassContext(classContext); + } finally { + refClasses = null; + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |