[Fb-contrib-commit] SF.net SVN: fb-contrib:[1196] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2009-05-09 22:48:16
|
Revision: 1196 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1196&view=rev Author: dbrosius Date: 2009-05-09 22:48:08 +0000 (Sat, 09 May 2009) Log Message: ----------- ignore map.puts Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 21:07:41 UTC (rev 1195) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 22:48:08 UTC (rev 1196) @@ -36,6 +36,10 @@ * method. It doesn't report method calls where the arguments are constants. */ public class StutteredMethodArguments extends BytecodeScanningDetector { + private static Set<String> ignorableSignatures = new HashSet<String>(); + static { + ignorableSignatures.add("java/util/Map:put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;"); + } private final BugReporter bugReporter; private OpcodeStack stack; @@ -90,15 +94,20 @@ case INVOKESTATIC: case INVOKEINTERFACE: case INVOKESPECIAL: + String clsName = getClassConstantOperand(); + String methodName = getNameConstantOperand(); String signature = getSigConstantOperand(); - Type[] args = Type.getArgumentTypes(signature); - if (args.length > 1) { - if (stack.getStackDepth() > args.length) { - if (duplicateArguments(stack, args.length)) { - bugReporter.reportBug(new BugInstance(this, "SMA_STUTTERED_METHOD_ARGUMENTS", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + String methodInfo = clsName + ":" + methodName + signature; + if (!ignorableSignatures.contains(methodInfo)) { + Type[] args = Type.getArgumentTypes(signature); + if (args.length > 1) { + if (stack.getStackDepth() > args.length) { + if (duplicateArguments(stack, args.length)) { + bugReporter.reportBug(new BugInstance(this, "SMA_STUTTERED_METHOD_ARGUMENTS", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |