[Fb-contrib-commit] SF.net SVN: fb-contrib: [953] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/d
Brought to you by:
dbrosius
From: <dbr...@us...> - 2007-11-03 03:57:39
|
Revision: 953 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=953&view=rev Author: dbrosius Date: 2007-11-02 20:57:43 -0700 (Fri, 02 Nov 2007) Log Message: ----------- primarily report the return pc, but also include the alter pc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-03 03:27:19 UTC (rev 952) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-03 03:57:43 UTC (rev 953) @@ -124,10 +124,11 @@ stack.resetForMethodEntry(this); super.visitCode(obj); for (ParmUsage pu : possibleParmRegs.values()) { - if (pu.returned && (pu.alteredPC >= 0)) { + if ((pu.returnPC >= 0) && (pu.alteredPC >= 0)) { bugReporter.reportBug(new BugInstance(this, "CFS_CONFUSING_FUNCTION_SEMANTICS", NORMAL_PRIORITY) .addClass(this) .addMethod(this) + .addSourceLine(this, pu.returnPC) .addSourceLine(this, pu.alteredPC)); } } @@ -150,7 +151,7 @@ int reg = item.getRegisterNumber(); ParmUsage pu = possibleParmRegs.get(Integer14.valueOf(reg)); if (pu != null) - pu.setReturned(); + pu.setReturnPC(getPC()); } } else if (seen == PUTFIELD) { if (stack.getStackDepth() > 1) { @@ -185,11 +186,11 @@ static class ParmUsage { - boolean returned = false; + int returnPC = -1; int alteredPC = -1; - public void setReturned() { - returned = true; + public void setReturnPC(int pc) { + returnPC = pc; } public void setAlteredPC(int pc) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2007-11-03 03:27:19 UTC (rev 952) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2007-11-03 03:57:43 UTC (rev 953) @@ -24,6 +24,7 @@ import java.util.Map; import java.util.Set; +import org.apache.bcel.Repository; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; @@ -179,7 +180,7 @@ if (populate) { possibleCommonTypes.addAll(Arrays.asList(infs)); possibleCommonTypes.addAll(Arrays.asList(supers)); - possibleCommonTypes.remove("java/lang/Object"); + possibleCommonTypes.remove(Repository.lookupClass("java/lang/Object")); populate = false; } else { Set<JavaClass> retain = new HashSet<JavaClass>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |