Thread: [Fb-contrib-commit] SF.net SVN: fb-contrib: [628] trunk/fb-contrib/src/com/mebigfatguy/ fbcontrib/
Brought to you by:
dbrosius
From: <dbr...@us...> - 2006-09-04 04:29:27
|
Revision: 628 http://svn.sourceforge.net/fb-contrib/?rev=628&view=rev Author: dbrosius Date: 2006-09-03 21:29:23 -0700 (Sun, 03 Sep 2006) Log Message: ----------- fix array return value handling Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 04:08:09 UTC (rev 627) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 04:29:23 UTC (rev 628) @@ -90,15 +90,15 @@ if (returnTypes.size() > 1) { JavaClass cls = findCommonType(returnTypes.keySet()); BugInstance bug = null; - if ((cls == null) || isInherited) { - bug = new BugInstance(this, "URV_UNRELATED_RETURN_VALUES", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this); - } else if (!isInherited) { + if ((cls != null) && !isInherited) { bug = new BugInstance(this, "URV_CHANGE_RETURN_TYPE", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this); + .addClass(this) + .addMethod(this); bug.addString(cls.getClassName()); + } else { + bug = new BugInstance(this, "URV_UNRELATED_RETURN_VALUES", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this); } if (bug != null) { for (Integer pc : returnTypes.values()) { @@ -144,6 +144,9 @@ classes.remove("java/lang/Object"); boolean populate = true; for (JavaClass cls : classes) { + if (cls == null) { //array + return null; + } JavaClass[] infs = cls.getAllInterfaces(); JavaClass[] supers = cls.getSuperClasses(); if (populate) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-04 05:18:48
|
Revision: 630 http://svn.sourceforge.net/fb-contrib/?rev=630&view=rev Author: dbrosius Date: 2006-09-03 22:18:44 -0700 (Sun, 03 Sep 2006) Log Message: ----------- more info for inherited methods Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 04:54:14 UTC (rev 629) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 05:18:44 UTC (rev 630) @@ -103,6 +103,7 @@ bug = new BugInstance(this, "URV_INHERITED_METHOD_WITH_RELATED_TYPES", NORMAL_PRIORITY) .addClass(this) .addMethod(this); + bug.addString(cls.getClassName()); } if (bug != null) { for (Integer pc : returnTypes.values()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-04 05:19:34
|
Revision: 631 http://svn.sourceforge.net/fb-contrib/?rev=631&view=rev Author: dbrosius Date: 2006-09-03 22:19:30 -0700 (Sun, 03 Sep 2006) Log Message: ----------- safer code for inherited methods Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 05:18:44 UTC (rev 630) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 05:19:30 UTC (rev 631) @@ -102,8 +102,9 @@ } else { bug = new BugInstance(this, "URV_INHERITED_METHOD_WITH_RELATED_TYPES", NORMAL_PRIORITY) .addClass(this) - .addMethod(this); - bug.addString(cls.getClassName()); + .addMethod(this); + if (cls != null) + bug.addString(cls.getClassName()); } if (bug != null) { for (Integer pc : returnTypes.values()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-04 05:33:08
|
Revision: 632 http://svn.sourceforge.net/fb-contrib/?rev=632&view=rev Author: dbrosius Date: 2006-09-03 22:32:59 -0700 (Sun, 03 Sep 2006) Log Message: ----------- if java.lang.Object is one of the actual return types, then lower the priority. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 05:19:30 UTC (rev 631) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 05:32:59 UTC (rev 632) @@ -88,19 +88,27 @@ returnTypes.clear(); super.visitCode(obj); if (returnTypes.size() > 1) { + int priority = NORMAL_PRIORITY; + for (JavaClass cls : returnTypes.keySet()) { + if ((cls != null) && "java.lang.Object".equals(cls.getClassName())) { + priority = LOW_PRIORITY; + break; + } + } + JavaClass cls = findCommonType(returnTypes.keySet()); BugInstance bug = null; if ((cls != null) && !isInherited) { - bug = new BugInstance(this, "URV_CHANGE_RETURN_TYPE", NORMAL_PRIORITY) + bug = new BugInstance(this, "URV_CHANGE_RETURN_TYPE", priority) .addClass(this) .addMethod(this); bug.addString(cls.getClassName()); } else if (!isInherited) { - bug = new BugInstance(this, "URV_UNRELATED_RETURN_VALUES", NORMAL_PRIORITY) + bug = new BugInstance(this, "URV_UNRELATED_RETURN_VALUES", priority) .addClass(this) .addMethod(this); } else { - bug = new BugInstance(this, "URV_INHERITED_METHOD_WITH_RELATED_TYPES", NORMAL_PRIORITY) + bug = new BugInstance(this, "URV_INHERITED_METHOD_WITH_RELATED_TYPES", priority) .addClass(this) .addMethod(this); if (cls != null) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-04 05:57:44
|
Revision: 633 http://svn.sourceforge.net/fb-contrib/?rev=633&view=rev Author: dbrosius Date: 2006-09-03 22:57:35 -0700 (Sun, 03 Sep 2006) Log Message: ----------- don't record null return values Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 05:32:59 UTC (rev 632) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-04 05:57:35 UTC (rev 633) @@ -137,7 +137,8 @@ if (seen == ARETURN) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); - returnTypes.put(itm.getJavaClass(), Integer14.valueOf(getPC())); + if (!itm.isNull()) + returnTypes.put(itm.getJavaClass(), Integer14.valueOf(getPC())); } } } catch (ClassNotFoundException cnfe) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-11 03:58:19
|
Revision: 642 http://svn.sourceforge.net/fb-contrib/?rev=642&view=rev Author: dbrosius Date: 2006-09-10 20:58:12 -0700 (Sun, 10 Sep 2006) Log Message: ----------- javadoc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-10 16:18:57 UTC (rev 641) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2006-09-11 03:58:12 UTC (rev 642) @@ -57,6 +57,11 @@ this.bugReporter = bugReporter; } + /** + * implements the visitor to create and destroy the stack and return types + * + * @param classContext the context object of the currently parsed class + */ public void visitClassContext(ClassContext classContext) { try { currentClass = classContext.getJavaClass(); @@ -130,6 +135,8 @@ /** * implements the visitor to find return values where the types of objects returned from the * method are related only by object. + * + * @param seen the opcode of the currently parsed instruction */ public void sawOpcode(int seen) { try { @@ -151,7 +158,7 @@ /** * looks for a common superclass or interface for all the passed in types * - * @param types the set of classes to look for a common super class or interface + * @param classes the set of classes to look for a common super class or interface * @return the type that is the common interface or superclass (not Object, tho). */ public JavaClass findCommonType(Set<JavaClass> classes) throws ClassNotFoundException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-01-28 20:53:12
|
Revision: 796 http://svn.sourceforge.net/fb-contrib/?rev=796&view=rev Author: dbrosius Date: 2007-01-28 12:53:12 -0800 (Sun, 28 Jan 2007) Log Message: ----------- GC fixes Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2007-01-28 20:49:56 UTC (rev 795) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2007-01-28 20:53:12 UTC (rev 796) @@ -165,12 +165,15 @@ */ public JavaClass findCommonType(Set<JavaClass> classes) throws ClassNotFoundException { Set<JavaClass> possibleCommonTypes = new HashSet<JavaClass>(); - classes.remove("java/lang/Object"); + boolean populate = true; for (JavaClass cls : classes) { - if (cls == null) { //array + if (cls == null) //array return null; - } + + if ("java/lang/Object".equals(cls.getClassName())) + continue; + JavaClass[] infs = cls.getAllInterfaces(); JavaClass[] supers = cls.getSuperClasses(); if (populate) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |