Revision: 477
Author: dbrosius
Date: 2006-04-18 15:24:26 -0700 (Tue, 18 Apr 2006)
ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=477&view=rev
Log Message:
-----------
Manually cleanup memory now that StatelessDetector is removed.
Modified Paths:
--------------
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2006-04-18 22:23:10 UTC (rev 476)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2006-04-18 22:24:26 UTC (rev 477)
@@ -25,14 +25,14 @@
import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugReporter;
import edu.umd.cs.findbugs.BytecodeScanningDetector;
-import edu.umd.cs.findbugs.StatelessDetector;
/**
* looks for methods that call a method to retrieve a reference to an object,
* to use to load a constant. It is simpler and more performant to access the
* static variable directly from the class itself.
*/
-public class NeedlessInstanceRetrieval extends BytecodeScanningDetector implements StatelessDetector {
+public class NeedlessInstanceRetrieval extends BytecodeScanningDetector
+{
private static final int SEEN_NOTHING = 0;
private static final int SEEN_INVOKE = 1;
private static final int SEEN_POP = 2;
@@ -49,16 +49,6 @@
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();
- }
-
/**
* overrides the interface to collect the line number table, and reset state
*
@@ -66,10 +56,14 @@
*/
@Override
public void visitCode(Code obj) {
- lnTable = obj.getLineNumberTable();
- if (lnTable != null) {
- state = SEEN_NOTHING;
- super.visitCode(obj);
+ try {
+ lnTable = obj.getLineNumberTable();
+ if (lnTable != null) {
+ state = SEEN_NOTHING;
+ super.visitCode(obj);
+ }
+ } finally {
+ lnTable = null;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|