Thread: [Fb-contrib-commit] SF.net SVN: fb-contrib: [458] trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/det
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-04-17 03:46:52
|
Revision: 458 Author: dbrosius Date: 2006-04-16 20:46:47 -0700 (Sun, 16 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=458&view=rev Log Message: ----------- Manually cleanup memory now that StatelessDetector is removed. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2006-04-17 03:44:46 UTC (rev 457) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2006-04-17 03:46:47 UTC (rev 458) @@ -41,10 +41,10 @@ /** * Looks for methods that are direct copies of the implementation in the super class */ -public class CopiedOverriddenMethod extends DismantleBytecode implements Detector, StatelessDetector +public class CopiedOverriddenMethod extends DismantleBytecode implements Detector { private BugReporter bugReporter; - private Map<String, Code> superclassCode = new HashMap<String, Code>(); + private Map<String, Code> superclassCode; private ClassContext classContext; private String curMethodInfo; private ConstantPoolGen childPoolGen, parentPoolGen; @@ -59,16 +59,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 accept classes derived from non java.lang.Object classes. * * @param classContext the context object of the currently parsed class @@ -79,7 +69,7 @@ String superName = cls.getSuperclassName(); if (!"java.lang.Object".equals(superName)) { this.classContext = classContext; - superclassCode.clear(); + superclassCode = new HashMap<String, Code>(); JavaClass superCls = cls.getSuperClass(); childPoolGen = new ConstantPoolGen(cls.getConstantPool()); parentPoolGen = new ConstantPoolGen(superCls.getConstantPool()); @@ -94,12 +84,14 @@ } } cls.accept(this); - superclassCode.clear(); - childPoolGen = null; - parentPoolGen = null; } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); + } finally { + superclassCode = null; + classContext = null; + childPoolGen = null; + parentPoolGen = null; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-04-17 03:47:51
|
Revision: 459 Author: dbrosius Date: 2006-04-16 20:47:47 -0700 (Sun, 16 Apr 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=459&view=rev Log Message: ----------- oi Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2006-04-17 03:46:47 UTC (rev 458) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2006-04-17 03:47:47 UTC (rev 459) @@ -34,7 +34,6 @@ import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.Detector; -import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; import edu.umd.cs.findbugs.visitclass.DismantleBytecode; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-06-03 05:19:32
|
Revision: 546 Author: dbrosius Date: 2006-06-02 22:19:26 -0700 (Fri, 02 Jun 2006) ViewCVS: http://svn.sourceforge.net/fb-contrib/?rev=546&view=rev Log Message: ----------- For COM, when invoking a method make sure the class, method name and signature match, not just the constant pool index :) Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2006-05-24 18:15:48 UTC (rev 545) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2006-06-03 05:19:26 UTC (rev 546) @@ -29,6 +29,7 @@ import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; +import org.apache.bcel.generic.InvokeInstruction; import org.apache.bcel.generic.ReferenceType; import edu.umd.cs.findbugs.BugInstance; @@ -173,6 +174,19 @@ if (!childRefType.getSignature().equals(parentRefType.getSignature())) return false; } + } else if (childin instanceof InvokeInstruction) { + String childClassName = ((InvokeInstruction) childin).getClassName(childPoolGen); + String parentClassName = ((InvokeInstruction) parentin).getClassName(parentPoolGen); + if (!childClassName.equals(parentClassName)) + return false; + String childMethodName = ((InvokeInstruction) childin).getMethodName(childPoolGen); + String parentMethodName = ((InvokeInstruction) parentin).getMethodName(parentPoolGen); + if (!childMethodName.equals(parentMethodName)) + return false; + String childSignature = ((InvokeInstruction) childin).getSignature(childPoolGen); + String parentSignature = ((InvokeInstruction) parentin).getSignature(parentPoolGen); + if (!childSignature.equals(parentSignature)) + return false; } else { if (!childin.equals(parentin)) return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |