[Fb-contrib-commit] SF.net SVN: fb-contrib: [453] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2006-04-17 03:36:12
|
Revision: 453 Author: dbrosius Date: 2006-04-16 20:36:08 -0700 (Sun, 16 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=453&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2006-04-17 03:33:31 UTC (rev 452) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2006-04-17 03:36:08 UTC (rev 453) @@ -33,14 +33,14 @@ import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.OpcodeStack; -import edu.umd.cs.findbugs.StatelessDetector; +import edu.umd.cs.findbugs.ba.ClassContext; /** * looks for methods that use an array of length one to pass a variable to achieve call * by pointer ala C++. It is better to define a proper return class type that holds all * the relevant information retrieved from the called method. */ -public class ArrayWrappedCallByReference extends BytecodeScanningDetector implements StatelessDetector { +public class ArrayWrappedCallByReference extends BytecodeScanningDetector { static class WrapperInfo { public int wrappedReg; @@ -53,8 +53,8 @@ } private BugReporter bugReporter; - private OpcodeStack stack = new OpcodeStack(); - private Map<Integer, WrapperInfo> wrappers = new HashMap<Integer, WrapperInfo>(); + private OpcodeStack stack; + private Map<Integer, WrapperInfo> wrappers; /** * constructs a AWCBR detector given the reporter to report bugs on @@ -65,17 +65,21 @@ this.bugReporter = bugReporter; } - /** - * clone this detector so that it can be a StatelessDetector - * - * @return a clone of this object - */ + /** + * implement the visitor to create and clear the stack and wrappers + * + * @param classContext the context object of the currently parsed class + */ @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); + public void visitClassContext(ClassContext classContext) { + stack = new OpcodeStack(); + wrappers = new HashMap<Integer, WrapperInfo>(); + super.visitClassContext(classContext); + stack = null; + wrappers = null; } - /** + /** * looks for methods that contain a NEWARRAY or ANEWARRAY opcodes * * @param method the context object of the current method This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |