[Fb-contrib-commit] SF.net SVN: fb-contrib: [488] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2006-04-19 00:53:28
|
Revision: 488 Author: dbrosius Date: 2006-04-18 17:53:23 -0700 (Tue, 18 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=488&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java 2006-04-19 00:51:10 UTC (rev 487) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java 2006-04-19 00:53:23 UTC (rev 488) @@ -30,7 +30,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; /** @@ -40,7 +39,8 @@ * use a separate thread to do the time consuming work so that the user * has a better experience. */ -public class SluggishGui extends BytecodeScanningDetector implements StatelessDetector { +public class SluggishGui extends BytecodeScanningDetector +{ private static final Set<String> expensiveCalls = new HashSet<String>(); static { @@ -76,9 +76,9 @@ } private BugReporter bugReporter; - private Set<String> expensiveThisCalls = new HashSet<String>(); - private Set<JavaClass> guiInterfaces = new HashSet<JavaClass>(); - private Map<Code,Method> listenerCode = new LinkedHashMap<Code,Method>(); + private Set<String> expensiveThisCalls; + private Set<JavaClass> guiInterfaces; + private Map<Code,Method> listenerCode; private String methodName; private String methodSig; private boolean isListenerMethod = false; @@ -94,16 +94,6 @@ } /** - * 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(); - } - - /** * overrides the visitor to reset look for gui interfaces * * @param classContext the context object for the currently parsed class @@ -111,9 +101,7 @@ @Override public void visitClassContext(ClassContext classContext) { try { - guiInterfaces.clear(); - listenerCode.clear(); - expensiveThisCalls.clear(); + guiInterfaces = new HashSet<JavaClass>(); JavaClass cls = classContext.getJavaClass(); JavaClass[] infs = cls.getAllInterfaces(); for (JavaClass inf : infs) { @@ -125,10 +113,17 @@ } } - if (guiInterfaces.size() > 0) + if (guiInterfaces.size() > 0) { + listenerCode = new LinkedHashMap<Code,Method>(); + expensiveThisCalls = new HashSet<String>(); super.visitClassContext(classContext); + } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); + } finally { + guiInterfaces = null; + listenerCode = null; + expensiveThisCalls = null; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |