fb-contrib-commit Mailing List for fb-contrib (Page 48)
Brought to you by:
dbrosius
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(56) |
Oct
(60) |
Nov
(58) |
Dec
(89) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(66) |
Feb
(55) |
Mar
(85) |
Apr
(115) |
May
(35) |
Jun
(28) |
Jul
(3) |
Aug
(48) |
Sep
(37) |
Oct
(22) |
Nov
(14) |
Dec
(66) |
2007 |
Jan
(45) |
Feb
(63) |
Mar
(10) |
Apr
(1) |
May
(1) |
Jun
(12) |
Jul
|
Aug
|
Sep
(25) |
Oct
(21) |
Nov
(39) |
Dec
|
2008 |
Jan
(7) |
Feb
|
Mar
(26) |
Apr
(5) |
May
(2) |
Jun
(32) |
Jul
(9) |
Aug
(10) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
|
2009 |
Jan
(10) |
Feb
(31) |
Mar
(32) |
Apr
(35) |
May
(25) |
Jun
|
Jul
(31) |
Aug
(10) |
Sep
(95) |
Oct
(35) |
Nov
(10) |
Dec
(34) |
2010 |
Jan
(90) |
Feb
(4) |
Mar
(7) |
Apr
(20) |
May
(20) |
Jun
(13) |
Jul
(7) |
Aug
(18) |
Sep
(25) |
Oct
(4) |
Nov
(16) |
Dec
(2) |
2011 |
Jan
(1) |
Feb
|
Mar
(11) |
Apr
(3) |
May
(2) |
Jun
(26) |
Jul
(10) |
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(14) |
Nov
(3) |
Dec
(4) |
2013 |
Jan
(3) |
Feb
(2) |
Mar
(1) |
Apr
(4) |
May
|
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
(4) |
Nov
(3) |
Dec
(3) |
2014 |
Jan
(4) |
Feb
(2) |
Mar
(4) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(3) |
Dec
(3) |
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
(2) |
Nov
(7) |
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
(5) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(3) |
2018 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(5) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dbr...@us...> - 2006-10-10 05:58:57
|
Revision: 665 http://svn.sourceforge.net/fb-contrib/?rev=665&view=rev Author: dbrosius Date: 2006-10-09 22:58:53 -0700 (Mon, 09 Oct 2006) Log Message: ----------- fix false positive due to putting enums into sets/maps, when you only know that the set or map is the interface, not any particular concrete class. Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java 2006-10-10 04:06:06 UTC (rev 664) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java 2006-10-10 05:58:53 UTC (rev 665) @@ -18,13 +18,18 @@ */ package com.mebigfatguy.fbcontrib.detect; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; import org.apache.bcel.Constants; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; +import com.mebigfatguy.fbcontrib.utils.Integer14; +import com.mebigfatguy.fbcontrib.utils.RegisterUtils; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -38,9 +43,20 @@ */ public class UseEnumCollections extends BytecodeScanningDetector { + private static final Set<String> nonEnumCollections = new HashSet<String>(); + static { + nonEnumCollections.add("Ljava/util/HashSet;"); + nonEnumCollections.add("Ljava/util/HashMap;"); + nonEnumCollections.add("Ljava/util/TreeMap;"); + nonEnumCollections.add("Ljava/util/ConcurrentHashMap"); + nonEnumCollections.add("Ljava/util/IdentityHashMap;"); + nonEnumCollections.add("Ljava/util/WeakHashMap;"); + } private BugReporter bugReporter; private OpcodeStack stack; private Set<String> checkedFields; + private Map<Integer, Boolean> enumRegs; + private Map<String, Boolean> enumFields; private boolean methodReported; /** * constructs a UEC detector given the reporter to report bugs on @@ -61,11 +77,15 @@ if (cls.getMajor() >= Constants.MAJOR_1_5) { stack = new OpcodeStack(); checkedFields = new HashSet<String>(); + enumRegs = new HashMap<Integer, Boolean>(); + enumFields = new HashMap<String, Boolean>(); super.visitClassContext(classContext); } } finally { stack = null; checkedFields = null; + enumRegs = null; + enumFields = null; } } @@ -77,17 +97,55 @@ public void visitMethod(Method obj) { stack.resetForMethodEntry(this); methodReported = false; + enumRegs.clear(); super.visitMethod(obj); } public void sawOpcode(int seen) { + Boolean sawEnumCollectionCreation = null; //true - enum, false - nonenum try { stack.mergeJumps(this); if (methodReported) return; - if (seen == INVOKEINTERFACE) { + if (seen == INVOKESTATIC) { + String clsName = getClassConstantOperand(); + String signature = getSigConstantOperand(); + if ("java/util/EnumSet".equals(clsName) && signature.endsWith(")Ljava/util/EnumSet;")) + sawEnumCollectionCreation = Boolean.TRUE; + } else if (seen == INVOKESPECIAL) { + String clsName = getClassConstantOperand(); + String methodName = getNameConstantOperand(); + if ("java/util/EnumMap".equals(clsName) && "<init>".equals(methodName)) + sawEnumCollectionCreation = Boolean.TRUE; + else if (clsName.startsWith("java/util/")) { + if (clsName.endsWith("Map") || clsName.endsWith("Set")) + sawEnumCollectionCreation = Boolean.FALSE; + } + } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item itm = stack.getStackItem(0); + Integer reg = Integer14.valueOf(RegisterUtils.getAStoreReg(this, seen)); + if (itm.getUserValue() != null) + enumRegs.put(reg, (Boolean)itm.getUserValue()); + else + enumRegs.remove(reg); + } + } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { + Integer reg = Integer14.valueOf(RegisterUtils.getALoadReg(this, seen)); + sawEnumCollectionCreation = enumRegs.get(reg); + } else if (seen == PUTFIELD) { + String fieldName = getNameConstantOperand(); + OpcodeStack.Item itm = stack.getStackItem(0); + if (itm.getUserValue() != null) + enumFields.put(fieldName, (Boolean)itm.getUserValue()); + else + enumFields.remove(fieldName); + } else if (seen == GETFIELD) { + String fieldName = getNameConstantOperand(); + sawEnumCollectionCreation = enumFields.get(fieldName); + } else if (seen == INVOKEINTERFACE) { boolean bug = false; String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); @@ -95,11 +153,11 @@ if (("java/util/Map".equals(clsName)) && ("put".equals(methodName)) && ("(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;".equals(signature))) { - bug = isEnum(1) && !isEnumCollection(1) && alreadyReported(2); + bug = isEnum(1) && !isEnumCollection(2) && !alreadyReported(2); } else if (("java/util/Set".equals(clsName)) && ("add".equals(methodName)) && ("(Ljava/lang/Object;)Z".equals(signature))) { - bug = isEnum(0) && !isEnumCollection(1) && alreadyReported(1); + bug = isEnum(0) && !isEnumCollection(1) && !alreadyReported(1); } if (bug) { @@ -114,6 +172,12 @@ bugReporter.reportMissingClass(cnfe); } finally { stack.sawOpcode(this, seen); + if (sawEnumCollectionCreation != null) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item itm = stack.getStackItem(0); + itm.setUserValue(sawEnumCollectionCreation); + } + } } } @@ -137,7 +201,7 @@ /** * returns whether the item at the stackpos location is an instance of an EnumSet or EnumMap * - * @param stackPos the posotion on the opstack to check + * @param stackPos the position on the opstack to check * * @return whether the class is an EnumSet or EnumMap */ @@ -146,8 +210,20 @@ return false; OpcodeStack.Item item = stack.getStackItem(stackPos); + + Boolean userValue = (Boolean)item.getUserValue(); + if (userValue != null) + return userValue.booleanValue(); + String realClass = item.getSignature(); - return "Ljava/util/EnumSet;".equals(realClass) || "Ljava/util/EnumMap;".equals(realClass); + if ("Ljava/util/EnumSet;".equals(realClass) || "Ljava/util/EnumMap;".equals(realClass)) + return true; + + if (nonEnumCollections.contains(realClass)) + return false; + + //Can't tell here so return true + return true; } /** @@ -162,12 +238,12 @@ OpcodeStack.Item item = stack.getStackItem(stackPos); FieldAnnotation fa = item.getField(); if (fa == null) - return true; + return false; else { String fieldName = fa.getFieldName(); boolean checked = checkedFields.contains(fieldName); checkedFields.add(fieldName); - return !checked; + return checked; } } return false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-10-10 04:06:21
|
Revision: 664 http://svn.sourceforge.net/fb-contrib/?rev=664&view=rev Author: dbrosius Date: 2006-10-09 21:06:06 -0700 (Mon, 09 Oct 2006) Log Message: ----------- add fp suggested by Jason Bennett #1540989 Modified Paths: -------------- trunk/fb-contrib/samples/UEC_Sample.java Modified: trunk/fb-contrib/samples/UEC_Sample.java =================================================================== --- trunk/fb-contrib/samples/UEC_Sample.java 2006-10-06 02:59:43 UTC (rev 663) +++ trunk/fb-contrib/samples/UEC_Sample.java 2006-10-10 04:06:06 UTC (rev 664) @@ -48,4 +48,16 @@ testSet.add(FalsePositive.B); } + + public Set<Suite> getSuites() + { + return EnumSet.<Suite>allOf(Suite.class); + } + + public void uecFP2() + { + Set<Suite> suites = getSuites(); + + suites.add(Suite.Clubs); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-10-06 02:59:57
|
Revision: 663 http://svn.sourceforge.net/fb-contrib/?rev=663&view=rev Author: dbrosius Date: 2006-10-05 19:59:43 -0700 (Thu, 05 Oct 2006) Log Message: ----------- made a copy Added Paths: ----------- tags/v3_0_0/ Copied: tags/v3_0_0 (from rev 662, ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-10-06 02:57:12
|
Revision: 662 http://svn.sourceforge.net/fb-contrib/?rev=662&view=rev Author: dbrosius Date: 2006-10-05 19:57:07 -0700 (Thu, 05 Oct 2006) Log Message: ----------- get ready for 3.0.0 Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2006-09-25 02:30:17 UTC (rev 661) +++ trunk/fb-contrib/build.xml 2006-10-06 02:57:07 UTC (rev 662) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="2.9.0"/> + <property name="fb-contrib.version" value="3.0.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2006-09-25 02:30:17 UTC (rev 661) +++ trunk/fb-contrib/htdocs/index.html 2006-10-06 02:57:07 UTC (rev 662) @@ -48,8 +48,13 @@ <a href="bugdescriptions.html">Bug Descriptions</a> <hr/> - <img id="svn_image" src="flip2.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> + <img id="svn_image" src="flip1.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> Detectors added in svn<br/> + <div id="svn" style="display:none;"> + </div> + <hr/> + <img id="v3_0_0_image" src="flip2.gif" onClick="toggleBlock('v3_0_0', 'svn_image');" align="top"/> + Detectors added in v3.0.0<br/> <div id="svn" style="display:block;"> <ul> <li><b>[LEST] Lost Exception Stack Trace</b><br/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-25 02:30:22
|
Revision: 661 http://svn.sourceforge.net/fb-contrib/?rev=661&view=rev Author: dbrosius Date: 2006-09-24 19:30:17 -0700 (Sun, 24 Sep 2006) Log Message: ----------- add close as risky Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2006-09-24 20:57:25 UTC (rev 660) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2006-09-25 02:30:17 UTC (rev 661) @@ -62,6 +62,7 @@ riskyMethodNameContents.add("pop"); riskyMethodNameContents.add("skip"); riskyMethodNameContents.add("clone"); + riskyMethodNameContents.add("close"); String userNameProp = System.getProperty(PRMC_RISKY_FIELD_USER_KEY); if (userNameProp != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-24 20:57:33
|
Revision: 660 http://svn.sourceforge.net/fb-contrib/?rev=660&view=rev Author: dbrosius Date: 2006-09-24 13:57:25 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2006-09-24 20:38:09 UTC (rev 659) +++ trunk/fb-contrib/etc/messages.xml 2006-09-24 20:57:25 UTC (rev 660) @@ -599,7 +599,7 @@ </Details> </Detector> - <Detector class="com.mebigfatguy.fbcontrib.detect.RedundantMethodCalls"> + <Detector class="com.mebigfatguy.fbcontrib.detect.PossiblyRedundantMethodCalls"> <Details> <![CDATA[ <p>looks for calls of the same method on the same object when that object hasn't changed. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-24 20:38:14
|
Revision: 659 http://svn.sourceforge.net/fb-contrib/?rev=659&view=rev Author: dbrosius Date: 2006-09-24 13:38:09 -0700 (Sun, 24 Sep 2006) Log Message: ----------- rename RMC for the weak in the stomach Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2006-09-24 20:36:16 UTC (rev 658) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2006-09-24 20:38:09 UTC (rev 659) @@ -190,7 +190,7 @@ Object[] parms = mc.getParms(); if (Arrays.equals(parms, parmConstants)) { Statistics statistics = Statistics.getStatistics(); - bugReporter.reportBug(new BugInstance(this, "PRMC_REDUNDANT_METHOD_CALLS", statistics.isSimpleGetter(getClassConstantOperand(), methodName, signature) ? EXP_PRIORITY : NORMAL_PRIORITY) + bugReporter.reportBug(new BugInstance(this, "PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS", statistics.isSimpleGetter(getClassConstantOperand(), methodName, signature) ? EXP_PRIORITY : 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. |
From: <dbr...@us...> - 2006-09-24 20:36:27
|
Revision: 658 http://svn.sourceforge.net/fb-contrib/?rev=658&view=rev Author: dbrosius Date: 2006-09-24 13:36:16 -0700 (Sun, 24 Sep 2006) Log Message: ----------- rename RMC for the weak in the stomach Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2006-09-24 20:35:11 UTC (rev 657) +++ trunk/fb-contrib/etc/messages.xml 2006-09-24 20:36:16 UTC (rev 658) @@ -1368,9 +1368,9 @@ </Details> </BugPattern> - <BugPattern type="RMC_REDUNDANT_METHOD_CALLS"> - <ShortDescription>Method calls the same method on the same object redundantly</ShortDescription> - <LongDescription>Method {1} calls the same method on the same object redundantly</LongDescription> + <BugPattern type="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS"> + <ShortDescription>Method appears to call the same method on the same object redundantly</ShortDescription> + <LongDescription>Method {1} appears to call the same method on the same object redundantly</LongDescription> <Details> <![CDATA[ <p>This method makes two consecutive calls to the same method using the same constant @@ -1536,7 +1536,7 @@ <BugCode abbrev="NMCS">Needless Member Collection Synchronization</BugCode> <BugCode abbrev="ITC">Inheritance Type Checking</BugCode> <BugCode abbrev="SACM">Static Array Created in Method</BugCode> - <BugCode abbrev="RMC">Redundant Method Calls</BugCode> + <BugCode abbrev="PRMC">Possibly Redundant Method Calls</BugCode> <BugCode abbrev="UTA">Use toArray</BugCode> <BugCode abbrev="LEST">Lost Exception Stack Trace</BugCode> <BugCode abbrev="UCPM">Use Character Parameterized Method</BugCode> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-24 20:35:17
|
Revision: 657 http://svn.sourceforge.net/fb-contrib/?rev=657&view=rev Author: dbrosius Date: 2006-09-24 13:35:11 -0700 (Sun, 24 Sep 2006) Log Message: ----------- rename RMC for the weak in the stomach Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2006-09-24 19:52:31 UTC (rev 656) +++ trunk/fb-contrib/etc/findbugs.xml 2006-09-24 20:35:11 UTC (rev 657) @@ -222,9 +222,9 @@ speed="fast" reports="SACM_STATIC_ARRAY_CREATED_IN_METHOD" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.RedundantMethodCalls" + <Detector class="com.mebigfatguy.fbcontrib.detect.PossiblyRedundantMethodCalls" speed="fast" - reports="RMC_REDUNDANT_METHOD_CALLS" /> + reports="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.UseToArray" speed="fast" @@ -304,7 +304,7 @@ <BugPattern abbrev="NMCS" type="NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION" category="PERFORMANCE" /> <BugPattern abbrev="ITC" type="ITC_INHERITANCE_TYPE_CHECKING" category="STYLE" /> <BugPattern abbrev="SACM" type="SACM_STATIC_ARRAY_CREATED_IN_METHOD" category="PERFORMANCE" /> - <BugPattern abbrev="RMC" type="RMC_REDUNDANT_METHOD_CALLS" category="PERFORMANCE" /> + <BugPattern abbrev="PRMC" type="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" category="PERFORMANCE" /> <BugPattern abbrev="UTA" type="UTA_USE_TO_ARRAY" category="STYLE" /> <BugPattern abbrev="LEST" type="LEST_LOST_EXCEPTION_STACK_TRACE" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="UCPM" type="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" category="PERFORMANCE" experimental="true" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-24 19:52:35
|
Revision: 656 http://svn.sourceforge.net/fb-contrib/?rev=656&view=rev Author: dbrosius Date: 2006-09-24 12:52:31 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Removed Paths: ------------- trunk/fb-contrib/.classpath trunk/fb-contrib/.project Deleted: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2006-09-24 19:51:17 UTC (rev 655) +++ trunk/fb-contrib/.classpath 2006-09-24 19:52:31 UTC (rev 656) @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="samples"/> - <classpathentry kind="lib" path="O:/fb-contrib/trunk/fb-contrib/lib/findbugs.jar"/> - <classpathentry kind="lib" path="O:/fb-contrib/trunk/fb-contrib/lib/bcel.jar"/> - <classpathentry kind="output" path="classes"/> -</classpath> Deleted: trunk/fb-contrib/.project =================================================================== --- trunk/fb-contrib/.project 2006-09-24 19:51:17 UTC (rev 655) +++ trunk/fb-contrib/.project 2006-09-24 19:52:31 UTC (rev 656) @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>fb-contrib</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - </natures> -</projectDescription> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-24 19:51:25
|
Revision: 655 http://svn.sourceforge.net/fb-contrib/?rev=655&view=rev Author: dbrosius Date: 2006-09-24 12:51:17 -0700 (Sun, 24 Sep 2006) Log Message: ----------- Modified Paths: -------------- trunk/fb-contrib/.classpath Removed Paths: ------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2006-09-24 19:49:47 UTC (rev 654) +++ trunk/fb-contrib/.classpath 2006-09-24 19:51:17 UTC (rev 655) @@ -3,8 +3,7 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="samples"/> - <classpathentry kind="lib" path="O:/fb-contrib/fb-contrib/lib/findbugs.jar"/> - <classpathentry kind="lib" path="O:/fb-contrib/fb-contrib/lib/bcel.jar"/> - <classpathentry kind="lib" path="O:/fb-contrib/fb-contrib/samples/lib/jsp-api.jar"/> + <classpathentry kind="lib" path="O:/fb-contrib/trunk/fb-contrib/lib/findbugs.jar"/> + <classpathentry kind="lib" path="O:/fb-contrib/trunk/fb-contrib/lib/bcel.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Deleted: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java 2006-09-24 19:49:47 UTC (rev 654) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java 2006-09-24 19:51:17 UTC (rev 655) @@ -1,265 +0,0 @@ -/* - * fb-contrib - Auxilliary detectors for Java programs - * Copyright (C) 2005-2006 Dave Brosius - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package com.mebigfatguy.fbcontrib.detect; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Locale; -import java.util.Map; -import java.util.Set; - -import org.apache.bcel.classfile.Code; -import org.apache.bcel.classfile.CodeException; -import org.apache.bcel.generic.Type; - -import com.mebigfatguy.fbcontrib.collect.Statistics; -import com.mebigfatguy.fbcontrib.utils.Integer14; -import com.mebigfatguy.fbcontrib.utils.RegisterUtils; - -import edu.umd.cs.findbugs.BugInstance; -import edu.umd.cs.findbugs.BugReporter; -import edu.umd.cs.findbugs.BytecodeScanningDetector; -import edu.umd.cs.findbugs.FieldAnnotation; -import edu.umd.cs.findbugs.OpcodeStack; -import edu.umd.cs.findbugs.ba.ClassContext; - -/** - * looks for calls of the same method on the same object when that object hasn't changed. - * This often is redundant, and the second call can be removed, or combined. - */ -public class RedundantMethodCalls extends BytecodeScanningDetector -{ - public static final String RMC_RISKY_FIELD_USER_KEY = "fbcontrib.RMC.riskynames"; - public static final String RMC_RISKY_CLASS_USER_KEY = "fbcontrib.RMC.riskyclasses"; - - private static Set<String> riskyMethodNameContents = new HashSet<String>(); - static { - riskyMethodNameContents.add("next"); - riskyMethodNameContents.add("add"); - riskyMethodNameContents.add("append"); - riskyMethodNameContents.add("put"); - riskyMethodNameContents.add("remove"); - riskyMethodNameContents.add("read"); - riskyMethodNameContents.add("write"); - riskyMethodNameContents.add("push"); - riskyMethodNameContents.add("pop"); - riskyMethodNameContents.add("skip"); - riskyMethodNameContents.add("clone"); - - String userNameProp = System.getProperty(RMC_RISKY_FIELD_USER_KEY); - if (userNameProp != null) { - String[] userNames = userNameProp.split("\\s*,\\s*"); - for (String name : userNames) - riskyMethodNameContents.add(name.toLowerCase()); - } - } - private static Set<String> riskyClassNames = new HashSet<String>(); - static { - riskyClassNames.add("java/nio/ByteBuffer"); - riskyClassNames.add("java/io/DataInputStream"); - riskyClassNames.add("java/io/ObjectInputStream"); - String userNameProp = System.getProperty(RMC_RISKY_CLASS_USER_KEY); - if (userNameProp != null) { - String[] userNames = userNameProp.split("\\s*,\\s*"); - for (String name : userNames) - riskyClassNames.add(name); - } - } - - private BugReporter bugReporter; - private OpcodeStack stack = null; - private Map<Integer, MethodCall> localMethodCalls = null; - private Map<String, MethodCall> fieldMethodCalls = null; - private Set<Integer> branchTargets = null; - - /** - * constructs a RMC detector given the reporter to report bugs on - * @param bugReporter the sync of bug reports - */ - public RedundantMethodCalls(BugReporter bugReporter) { - this.bugReporter = bugReporter; - } - - /** - * implements the visitor to create and clear the stack, method call maps, and branch targets - * - * @param classContext the context object of the currently visited class - */ - public void visitClassContext(ClassContext classContext) { - try { - stack = new OpcodeStack(); - localMethodCalls = new HashMap<Integer, MethodCall>(); - fieldMethodCalls = new HashMap<String, MethodCall>(); - branchTargets = new HashSet<Integer>(); - super.visitClassContext(classContext); - } finally { - stack = null; - localMethodCalls = null; - fieldMethodCalls = null; - branchTargets = null; - } - } - - /** - * implements the visitor to reset the stack, and method call maps for new method - * - * @param obj the context object of the currently parsed code block - */ - public void visitCode(Code obj) { - stack.resetForMethodEntry(this); - localMethodCalls.clear(); - fieldMethodCalls.clear(); - branchTargets.clear(); - CodeException[] codeExceptions = obj.getExceptionTable(); - for (CodeException codeEx : codeExceptions) { - branchTargets.add(codeEx.getHandlerPC()); - } - super.visitCode(obj); - } - - /** - * implements the visitor to look for repetitive calls to the same method on the same object - * using the same constant parameters. These methods must return a value. - * - * @param seen the opcode of the currently parsed instruction - */ - public void sawOpcode(int seen) { - try { - stack.mergeJumps(this); - if (branchTargets.remove(Integer14.valueOf(getPC()))) { - localMethodCalls.clear(); - fieldMethodCalls.clear(); - } - - if (((seen >= IFEQ) && (seen <= GOTO)) || ((seen >= IFNULL) && (seen <= GOTO_W))) { - branchTargets.add(Integer14.valueOf(getBranchTarget())); - } else if ((seen == TABLESWITCH) || (seen == LOOKUPSWITCH)) { - int[] offsets = getSwitchOffsets(); - int pc = getPC(); - for (int offset : offsets) { - branchTargets.add(Integer14.valueOf(offset + pc)); - } - } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { - localMethodCalls.remove(Integer14.valueOf(RegisterUtils.getAStoreReg(this, seen))); - } else if (seen == PUTFIELD) { - fieldMethodCalls.remove(getNameConstantOperand()); - } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { - String className = getClassConstantOperand(); - String methodName = getNameConstantOperand(); - String signature = getSigConstantOperand(); - int parmCount = Type.getArgumentTypes(signature).length; - if (stack.getStackDepth() > parmCount) { - Object[] parmConstants = new Object[parmCount]; - for (int i = 0; i < parmCount; i++) { - OpcodeStack.Item parm = stack.getStackItem(i); - parmConstants[i] = parm.getConstant(); - if (parmConstants[i] == null) - return; - } - OpcodeStack.Item obj = stack.getStackItem(parmCount); - int reg = obj.getRegisterNumber(); - FieldAnnotation fa = obj.getField(); - - MethodCall mc; - if (reg >= 0) { - mc = localMethodCalls.get(Integer14.valueOf(reg)); - } else if (fa != null) { - mc = fieldMethodCalls.get(fa.getFieldName()); - } else - return; - - if (mc != null) { - if (!signature.endsWith("V") && methodName.equals(mc.getName()) && signature.equals(mc.getSignature()) && !isRiskyName(className, methodName)) { - Object[] parms = mc.getParms(); - if (Arrays.equals(parms, parmConstants)) { - Statistics statistics = Statistics.getStatistics(); - bugReporter.reportBug(new BugInstance(this, "RMC_REDUNDANT_METHOD_CALLS", statistics.isSimpleGetter(getClassConstantOperand(), methodName, signature) ? EXP_PRIORITY : NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this) - .addString(methodName + signature)); - } - } - if (reg >= 0) { - localMethodCalls.remove(Integer14.valueOf(reg)); - } else { - fieldMethodCalls.remove(fa.getFieldName()); - } - } else { - if (reg >= 0) { - localMethodCalls.put(Integer14.valueOf(reg), new MethodCall(methodName, signature, parmConstants)); - } else if (fa != null) { - fieldMethodCalls.put(fa.getFieldName(), new MethodCall(methodName, signature, parmConstants)); - } - } - } - } - } finally { - stack.sawOpcode(this, seen); - } - } - - /** - * returns true if the class or method name contains a pattern that is considered likely to be this modifying - * - * @param className the class name to check - * @param methodName the method name to check - * @return whether the method sounds like it modifies this - */ - private boolean isRiskyName(String className, String methodName) { - if (riskyClassNames.contains(className)) - return true; - - methodName = methodName.toLowerCase(Locale.ENGLISH); - for (String riskyName : riskyMethodNameContents) { - if (methodName.indexOf(riskyName) >= 0) - return true; - } - return false; - } - - /** - * contains information about a method call - */ - static class MethodCall - { - private String methodName; - private String methodSignature; - private Object[] methodParms; - - public MethodCall(String name, String signature, Object[] parms) { - methodName = name; - methodSignature = signature; - methodParms = parms; - } - - public String getName() { - return methodName; - } - - public String getSignature() { - return methodSignature; - } - - public Object[] getParms() { - return methodParms; - } - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-24 19:49:53
|
Revision: 654 http://svn.sourceforge.net/fb-contrib/?rev=654&view=rev Author: dbrosius Date: 2006-09-24 12:49:47 -0700 (Sun, 24 Sep 2006) Log Message: ----------- rename for those with weak stomachs Added Paths: ----------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2006-09-24 19:49:47 UTC (rev 654) @@ -0,0 +1,265 @@ +/* + * fb-contrib - Auxilliary detectors for Java programs + * Copyright (C) 2005-2006 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.mebigfatguy.fbcontrib.detect; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.CodeException; +import org.apache.bcel.generic.Type; + +import com.mebigfatguy.fbcontrib.collect.Statistics; +import com.mebigfatguy.fbcontrib.utils.Integer14; +import com.mebigfatguy.fbcontrib.utils.RegisterUtils; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.BytecodeScanningDetector; +import edu.umd.cs.findbugs.FieldAnnotation; +import edu.umd.cs.findbugs.OpcodeStack; +import edu.umd.cs.findbugs.ba.ClassContext; + +/** + * looks for calls of the same method on the same object when that object hasn't changed. + * This often is redundant, and the second call can be removed, or combined. + */ +public class PossiblyRedundantMethodCalls extends BytecodeScanningDetector +{ + public static final String PRMC_RISKY_FIELD_USER_KEY = "fbcontrib.PRMC.riskynames"; + public static final String PRMC_RISKY_CLASS_USER_KEY = "fbcontrib.PRMC.riskyclasses"; + + private static Set<String> riskyMethodNameContents = new HashSet<String>(); + static { + riskyMethodNameContents.add("next"); + riskyMethodNameContents.add("add"); + riskyMethodNameContents.add("append"); + riskyMethodNameContents.add("put"); + riskyMethodNameContents.add("remove"); + riskyMethodNameContents.add("read"); + riskyMethodNameContents.add("write"); + riskyMethodNameContents.add("push"); + riskyMethodNameContents.add("pop"); + riskyMethodNameContents.add("skip"); + riskyMethodNameContents.add("clone"); + + String userNameProp = System.getProperty(PRMC_RISKY_FIELD_USER_KEY); + if (userNameProp != null) { + String[] userNames = userNameProp.split("\\s*,\\s*"); + for (String name : userNames) + riskyMethodNameContents.add(name.toLowerCase()); + } + } + private static Set<String> riskyClassNames = new HashSet<String>(); + static { + riskyClassNames.add("java/nio/ByteBuffer"); + riskyClassNames.add("java/io/DataInputStream"); + riskyClassNames.add("java/io/ObjectInputStream"); + String userNameProp = System.getProperty(PRMC_RISKY_CLASS_USER_KEY); + if (userNameProp != null) { + String[] userNames = userNameProp.split("\\s*,\\s*"); + for (String name : userNames) + riskyClassNames.add(name); + } + } + + private BugReporter bugReporter; + private OpcodeStack stack = null; + private Map<Integer, MethodCall> localMethodCalls = null; + private Map<String, MethodCall> fieldMethodCalls = null; + private Set<Integer> branchTargets = null; + + /** + * constructs a PRMC detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ + public PossiblyRedundantMethodCalls(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + /** + * implements the visitor to create and clear the stack, method call maps, and branch targets + * + * @param classContext the context object of the currently visited class + */ + public void visitClassContext(ClassContext classContext) { + try { + stack = new OpcodeStack(); + localMethodCalls = new HashMap<Integer, MethodCall>(); + fieldMethodCalls = new HashMap<String, MethodCall>(); + branchTargets = new HashSet<Integer>(); + super.visitClassContext(classContext); + } finally { + stack = null; + localMethodCalls = null; + fieldMethodCalls = null; + branchTargets = null; + } + } + + /** + * implements the visitor to reset the stack, and method call maps for new method + * + * @param obj the context object of the currently parsed code block + */ + public void visitCode(Code obj) { + stack.resetForMethodEntry(this); + localMethodCalls.clear(); + fieldMethodCalls.clear(); + branchTargets.clear(); + CodeException[] codeExceptions = obj.getExceptionTable(); + for (CodeException codeEx : codeExceptions) { + branchTargets.add(codeEx.getHandlerPC()); + } + super.visitCode(obj); + } + + /** + * implements the visitor to look for repetitive calls to the same method on the same object + * using the same constant parameters. These methods must return a value. + * + * @param seen the opcode of the currently parsed instruction + */ + public void sawOpcode(int seen) { + try { + stack.mergeJumps(this); + if (branchTargets.remove(Integer14.valueOf(getPC()))) { + localMethodCalls.clear(); + fieldMethodCalls.clear(); + } + + if (((seen >= IFEQ) && (seen <= GOTO)) || ((seen >= IFNULL) && (seen <= GOTO_W))) { + branchTargets.add(Integer14.valueOf(getBranchTarget())); + } else if ((seen == TABLESWITCH) || (seen == LOOKUPSWITCH)) { + int[] offsets = getSwitchOffsets(); + int pc = getPC(); + for (int offset : offsets) { + branchTargets.add(Integer14.valueOf(offset + pc)); + } + } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { + localMethodCalls.remove(Integer14.valueOf(RegisterUtils.getAStoreReg(this, seen))); + } else if (seen == PUTFIELD) { + fieldMethodCalls.remove(getNameConstantOperand()); + } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { + String className = getClassConstantOperand(); + String methodName = getNameConstantOperand(); + String signature = getSigConstantOperand(); + int parmCount = Type.getArgumentTypes(signature).length; + if (stack.getStackDepth() > parmCount) { + Object[] parmConstants = new Object[parmCount]; + for (int i = 0; i < parmCount; i++) { + OpcodeStack.Item parm = stack.getStackItem(i); + parmConstants[i] = parm.getConstant(); + if (parmConstants[i] == null) + return; + } + OpcodeStack.Item obj = stack.getStackItem(parmCount); + int reg = obj.getRegisterNumber(); + FieldAnnotation fa = obj.getField(); + + MethodCall mc; + if (reg >= 0) { + mc = localMethodCalls.get(Integer14.valueOf(reg)); + } else if (fa != null) { + mc = fieldMethodCalls.get(fa.getFieldName()); + } else + return; + + if (mc != null) { + if (!signature.endsWith("V") && methodName.equals(mc.getName()) && signature.equals(mc.getSignature()) && !isRiskyName(className, methodName)) { + Object[] parms = mc.getParms(); + if (Arrays.equals(parms, parmConstants)) { + Statistics statistics = Statistics.getStatistics(); + bugReporter.reportBug(new BugInstance(this, "PRMC_REDUNDANT_METHOD_CALLS", statistics.isSimpleGetter(getClassConstantOperand(), methodName, signature) ? EXP_PRIORITY : NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this) + .addString(methodName + signature)); + } + } + if (reg >= 0) { + localMethodCalls.remove(Integer14.valueOf(reg)); + } else { + fieldMethodCalls.remove(fa.getFieldName()); + } + } else { + if (reg >= 0) { + localMethodCalls.put(Integer14.valueOf(reg), new MethodCall(methodName, signature, parmConstants)); + } else if (fa != null) { + fieldMethodCalls.put(fa.getFieldName(), new MethodCall(methodName, signature, parmConstants)); + } + } + } + } + } finally { + stack.sawOpcode(this, seen); + } + } + + /** + * returns true if the class or method name contains a pattern that is considered likely to be this modifying + * + * @param className the class name to check + * @param methodName the method name to check + * @return whether the method sounds like it modifies this + */ + private boolean isRiskyName(String className, String methodName) { + if (riskyClassNames.contains(className)) + return true; + + methodName = methodName.toLowerCase(Locale.ENGLISH); + for (String riskyName : riskyMethodNameContents) { + if (methodName.indexOf(riskyName) >= 0) + return true; + } + return false; + } + + /** + * contains information about a method call + */ + static class MethodCall + { + private String methodName; + private String methodSignature; + private Object[] methodParms; + + public MethodCall(String name, String signature, Object[] parms) { + methodName = name; + methodSignature = signature; + methodParms = parms; + } + + public String getName() { + return methodName; + } + + public String getSignature() { + return methodSignature; + } + + public Object[] getParms() { + return methodParms; + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-16 13:52:26
|
Revision: 653 http://svn.sourceforge.net/fb-contrib/?rev=653&view=rev Author: dbrosius Date: 2006-09-16 06:52:22 -0700 (Sat, 16 Sep 2006) Log Message: ----------- change simple getter reporting to EXP_PRIORITY Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java 2006-09-16 04:38:48 UTC (rev 652) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java 2006-09-16 13:52:22 UTC (rev 653) @@ -190,7 +190,7 @@ Object[] parms = mc.getParms(); if (Arrays.equals(parms, parmConstants)) { Statistics statistics = Statistics.getStatistics(); - bugReporter.reportBug(new BugInstance(this, "RMC_REDUNDANT_METHOD_CALLS", statistics.isSimpleGetter(getClassConstantOperand(), methodName, signature) ? LOW_PRIORITY : NORMAL_PRIORITY) + bugReporter.reportBug(new BugInstance(this, "RMC_REDUNDANT_METHOD_CALLS", statistics.isSimpleGetter(getClassConstantOperand(), methodName, signature) ? EXP_PRIORITY : 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. |
From: <dbr...@us...> - 2006-09-16 04:38:54
|
Revision: 652 http://svn.sourceforge.net/fb-contrib/?rev=652&view=rev Author: dbrosius Date: 2006-09-15 21:38:48 -0700 (Fri, 15 Sep 2006) Log Message: ----------- remove some false positives Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2006-09-16 03:39:53 UTC (rev 651) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2006-09-16 04:38:48 UTC (rev 652) @@ -172,7 +172,6 @@ else addCatchBlock(ex.getHandlerPC(), Integer.MAX_VALUE); } - return; } else if (pc == ex.getHandlerPC()) { removePreviousHandlers(pc); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-16 03:39:57
|
Revision: 651 http://svn.sourceforge.net/fb-contrib/?rev=651&view=rev Author: dbrosius Date: 2006-09-15 20:39:53 -0700 (Fri, 15 Sep 2006) Log Message: ----------- add 'skip' as risky Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java 2006-09-15 22:44:04 UTC (rev 650) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java 2006-09-16 03:39:53 UTC (rev 651) @@ -60,6 +60,7 @@ riskyMethodNameContents.add("write"); riskyMethodNameContents.add("push"); riskyMethodNameContents.add("pop"); + riskyMethodNameContents.add("skip"); riskyMethodNameContents.add("clone"); String userNameProp = System.getProperty(RMC_RISKY_FIELD_USER_KEY); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-15 22:44:13
|
Revision: 650 http://svn.sourceforge.net/fb-contrib/?rev=650&view=rev Author: dbrosius Date: 2006-09-15 15:44:04 -0700 (Fri, 15 Sep 2006) Log Message: ----------- add risky classes to ignore as well, especially ByteBuffer Modified Paths: -------------- trunk/fb-contrib/samples/RMC_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java Modified: trunk/fb-contrib/samples/RMC_Sample.java =================================================================== --- trunk/fb-contrib/samples/RMC_Sample.java 2006-09-14 04:57:15 UTC (rev 649) +++ trunk/fb-contrib/samples/RMC_Sample.java 2006-09-15 22:44:04 UTC (rev 650) @@ -1,3 +1,4 @@ +import java.nio.ByteBuffer; import java.util.Calendar; import java.util.Date; @@ -11,4 +12,10 @@ long j = e.getTime(); return l == j; } + + public void rmcFP(ByteBuffer bb) + { + int i = bb.getInt(); + int j = bb.getInt(); + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java 2006-09-14 04:57:15 UTC (rev 649) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/RedundantMethodCalls.java 2006-09-15 22:44:04 UTC (rev 650) @@ -46,7 +46,8 @@ */ public class RedundantMethodCalls extends BytecodeScanningDetector { - public static final String RMC_RISKY_USER_KEY = "fbcontrib.RMC.riskynames"; + public static final String RMC_RISKY_FIELD_USER_KEY = "fbcontrib.RMC.riskynames"; + public static final String RMC_RISKY_CLASS_USER_KEY = "fbcontrib.RMC.riskyclasses"; private static Set<String> riskyMethodNameContents = new HashSet<String>(); static { @@ -61,13 +62,26 @@ riskyMethodNameContents.add("pop"); riskyMethodNameContents.add("clone"); - String userNameProp = System.getProperty(RMC_RISKY_USER_KEY); + String userNameProp = System.getProperty(RMC_RISKY_FIELD_USER_KEY); if (userNameProp != null) { String[] userNames = userNameProp.split("\\s*,\\s*"); for (String name : userNames) riskyMethodNameContents.add(name.toLowerCase()); } } + private static Set<String> riskyClassNames = new HashSet<String>(); + static { + riskyClassNames.add("java/nio/ByteBuffer"); + riskyClassNames.add("java/io/DataInputStream"); + riskyClassNames.add("java/io/ObjectInputStream"); + String userNameProp = System.getProperty(RMC_RISKY_CLASS_USER_KEY); + if (userNameProp != null) { + String[] userNames = userNameProp.split("\\s*,\\s*"); + for (String name : userNames) + riskyClassNames.add(name); + } + } + private BugReporter bugReporter; private OpcodeStack stack = null; private Map<Integer, MethodCall> localMethodCalls = null; @@ -146,6 +160,7 @@ } else if (seen == PUTFIELD) { fieldMethodCalls.remove(getNameConstantOperand()); } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { + String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); String signature = getSigConstantOperand(); int parmCount = Type.getArgumentTypes(signature).length; @@ -170,7 +185,7 @@ return; if (mc != null) { - if (!signature.endsWith("V") && methodName.equals(mc.getName()) && signature.equals(mc.getSignature()) && !isRiskyName(methodName)) { + if (!signature.endsWith("V") && methodName.equals(mc.getName()) && signature.equals(mc.getSignature()) && !isRiskyName(className, methodName)) { Object[] parms = mc.getParms(); if (Arrays.equals(parms, parmConstants)) { Statistics statistics = Statistics.getStatistics(); @@ -201,12 +216,16 @@ } /** - * returns true if the method name contains a pattern that is considered likely to be this modifying + * returns true if the class or method name contains a pattern that is considered likely to be this modifying * + * @param className the class name to check * @param methodName the method name to check * @return whether the method sounds like it modifies this */ - private boolean isRiskyName(String methodName) { + private boolean isRiskyName(String className, String methodName) { + if (riskyClassNames.contains(className)) + return true; + methodName = methodName.toLowerCase(Locale.ENGLISH); for (String riskyName : riskyMethodNameContents) { if (methodName.indexOf(riskyName) >= 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-14 04:57:19
|
Revision: 649 http://svn.sourceforge.net/fb-contrib/?rev=649&view=rev Author: dbrosius Date: 2006-09-13 21:57:15 -0700 (Wed, 13 Sep 2006) Log Message: ----------- add TODOs to AFBR Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2006-09-14 04:42:03 UTC (rev 648) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2006-09-14 04:57:15 UTC (rev 649) @@ -27,6 +27,8 @@ import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; +import edu.umd.cs.findbugs.FindBugsAnalysisFeatures; +import edu.umd.cs.findbugs.ba.AnalysisContext; import edu.umd.cs.findbugs.ba.ClassContext; /** @@ -54,6 +56,10 @@ */ @Override public void visitClassContext(ClassContext classContext) { + //TODO: Look at method calls in a finally block to see if they throw exceptions + // : and those exceptions are not caught in the finally block + // : Only do it if effort is on, ie: boolean fullAnalysis = AnalysisContext.currentAnalysisContext().getBoolProperty(FindBugsAnalysisFeatures.INTERPROCEDURAL_ANALYSIS_OF_REFERENCED_CLASSES); + try { int majorVersion = classContext.getJavaClass().getMajor(); if (majorVersion >= MAJOR_1_4) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-14 04:42:08
|
Revision: 648 http://svn.sourceforge.net/fb-contrib/?rev=648&view=rev Author: dbrosius Date: 2006-09-13 21:42:03 -0700 (Wed, 13 Sep 2006) Log Message: ----------- add StringBuffer to LSYC for classes compiled in 1.5 Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2006-09-12 04:05:23 UTC (rev 647) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2006-09-14 04:42:03 UTC (rev 648) @@ -24,6 +24,7 @@ import java.util.Map; import java.util.Set; +import org.apache.bcel.Constants; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; @@ -45,10 +46,11 @@ */ public class LocalSynchronizedCollection extends BytecodeScanningDetector { - private static Set<String> syncCtors = new HashSet<String>(); + private static Map<String, Integer> syncCtors = new HashMap<String, Integer>(); static { - syncCtors.add("java/util/Vector"); - syncCtors.add("java/util/Hashtable"); + syncCtors.put("java/util/Vector", Integer14.valueOf(Constants.MAJOR_1_1)); + syncCtors.put("java/util/Hashtable", Integer14.valueOf(Constants.MAJOR_1_1)); + syncCtors.put("java/lang/StringBuffer", Integer14.valueOf(Constants.MAJOR_1_5)); } private static Set<String> syncMethods = new HashSet<String>(); static { @@ -63,6 +65,8 @@ private BugReporter bugReporter; private OpcodeStack stack; private Map<Integer, CollectionRegInfo> syncRegs; + private int classVersion; + /** * constructs a LSYC detector given the reporter to report bugs on * @param bugReporter the sync of bug reports @@ -81,6 +85,7 @@ try { stack = new OpcodeStack(); syncRegs = new HashMap<Integer, CollectionRegInfo>(); + classVersion = classContext.getJavaClass().getMajor(); super.visitClassContext(classContext); } finally { stack = null; @@ -137,7 +142,8 @@ if (seen == INVOKESPECIAL) { if ("<init>".equals(getNameConstantOperand())) { - if (syncCtors.contains(getClassConstantOperand())) { + Integer minVersion = syncCtors.get(getClassConstantOperand()); + if ((minVersion != null) && (classVersion >= minVersion.intValue())) { tosIsSyncColReg = Integer14.valueOf(-1); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-12 04:05:27
|
Revision: 647 http://svn.sourceforge.net/fb-contrib/?rev=647&view=rev Author: dbrosius Date: 2006-09-11 21:05:23 -0700 (Mon, 11 Sep 2006) Log Message: ----------- remove unused Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2006-09-12 02:57:27 UTC (rev 646) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2006-09-12 04:05:23 UTC (rev 647) @@ -13,7 +13,6 @@ private static final int SG_SAW_NOTHING = 0; private static final int SG_SAW_ALOAD_0 = 1; private static final int SG_SAW_GETFIELD = 2; - private static final int SG_SAW_RETURN = 3; private int sgState; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-12 02:57:33
|
Revision: 646 http://svn.sourceforge.net/fb-contrib/?rev=646&view=rev Author: dbrosius Date: 2006-09-11 19:57:27 -0700 (Mon, 11 Sep 2006) Log Message: ----------- don't report no setLabelFor when the JLabel doesn't have a String Modified Paths: -------------- trunk/fb-contrib/samples/S508C_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java Modified: trunk/fb-contrib/samples/S508C_Sample.java =================================================================== --- trunk/fb-contrib/samples/S508C_Sample.java 2006-09-11 05:20:58 UTC (rev 645) +++ trunk/fb-contrib/samples/S508C_Sample.java 2006-09-12 02:57:27 UTC (rev 646) @@ -1,6 +1,7 @@ import java.awt.Color; import java.awt.Container; +import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; @@ -8,6 +9,7 @@ public class S508C_Sample extends JFrame { private JLabel fLabel = new JLabel("Hello"); + private JLabel imgLabel = new JLabel(new ImageIcon("/boo.gif")); private JComponent c = new MyComponent(); public S508C_Sample() { @@ -19,6 +21,9 @@ lLabel.setBackground(new Color(255, 0, 0)); lLabel.setForeground(new Color(255, 255, 100)); cp.add(lLabel); + + JLabel picLabel = new JLabel(new ImageIcon("/foo.gif")); + cp.add(picLabel); cp.add(c); setSize(300, 200); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2006-09-11 05:20:58 UTC (rev 645) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2006-09-12 02:57:27 UTC (rev 646) @@ -164,16 +164,37 @@ */ @Override public void sawOpcode(int seen) { + boolean sawTextLabel = false; try { stack.mergeJumps(this); if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); - if ("Ljavax/swing/JLabel;".equals(item.getSignature())) { + if ("Ljavax/swing/JLabel;".equals(item.getSignature()) + && (item.getUserValue() != null)) { int reg = RegisterUtils.getAStoreReg(this, seen); localLabels.put(Integer14.valueOf(reg), SourceLineAnnotation.fromVisitedInstruction(this)); } } + } else if (seen == PUTFIELD) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + if (item.getUserValue() == null) { + FieldAnnotation fa = new FieldAnnotation(getClassName(), getNameConstantOperand(), getSigConstantOperand(), false); + if (fa != null) + fieldLabels.remove(fa); + } + } + } else if (seen == INVOKESPECIAL) { + String className = getClassConstantOperand(); + String methodName = getNameConstantOperand(); + if ("javax/swing/JLabel".equals(className) + && "<init>".equals(methodName)) { + String signature = getSigConstantOperand(); + if (signature.indexOf("Ljava/lang/String;") >= 0) { + sawTextLabel = true; + } + } } else if (seen == INVOKEVIRTUAL) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); @@ -238,6 +259,12 @@ bugReporter.reportMissingClass(cnfe); } finally { stack.sawOpcode(this, seen); + if (sawTextLabel) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + item.setUserValue(Boolean.TRUE); + } + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-11 05:21:03
|
Revision: 645 http://svn.sourceforge.net/fb-contrib/?rev=645&view=rev Author: dbrosius Date: 2006-09-10 22:20:58 -0700 (Sun, 10 Sep 2006) Log Message: ----------- remove BSB doc for now Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2006-09-11 05:17:55 UTC (rev 644) +++ trunk/fb-contrib/htdocs/index.html 2006-09-11 05:20:58 UTC (rev 645) @@ -52,10 +52,6 @@ Detectors added in svn<br/> <div id="svn" style="display:block;"> <ul> - <li><b>[BSB] Bloated Synchronized Block</b><br/> - Looks for methods that implement synchronized blocks that appear to contain some code at - the beginning that does not need to be synchronized. Moving these lines out of the synchronized - block should help multithreaded performance.</li> <li><b>[LEST] Lost Exception Stack Trace</b><br/> Looks for methods that catch exceptions, and rethrow another exception without encapsulating the original exception within it. Doing this loses the stack history, and where the original This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-11 05:18:02
|
Revision: 644 http://svn.sourceforge.net/fb-contrib/?rev=644&view=rev Author: dbrosius Date: 2006-09-10 22:17:55 -0700 (Sun, 10 Sep 2006) Log Message: ----------- doc Tailrecursion Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2006-09-11 05:10:23 UTC (rev 643) +++ trunk/fb-contrib/htdocs/index.html 2006-09-11 05:17:55 UTC (rev 644) @@ -64,6 +64,10 @@ Looks for methods that pass single character string constants as parameters to methods that alternatively have an overridden method that accepts a character instead. It is easier for the method to handle a single character than a String.</li> + <li><b>[TR] Tail Recursion</b><br/> + Looks for methods that make a recursive call to itself as the last statement in + the method. This tail recursion could be converted into a simple loop which would + improve the performance and stack requirements.</li> <li><b>[URV] Unrelated Return Values</b><br/> Looks for methods that return Object, and who's code body returns two or more different types of objects that are unrelated (other than by Object).</li> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2006-09-11 05:10:32
|
Revision: 643 http://svn.sourceforge.net/fb-contrib/?rev=643&view=rev Author: dbrosius Date: 2006-09-10 22:10:23 -0700 (Sun, 10 Sep 2006) Log Message: ----------- add stylesheet, and ant target to generate html file with bug descriptions, add to index page Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/htdocs/index.html Added Paths: ----------- trunk/fb-contrib/etc/bugdescriptions.xsl Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2006-09-11 03:58:12 UTC (rev 642) +++ trunk/fb-contrib/build.xml 2006-09-11 05:10:23 UTC (rev 643) @@ -14,6 +14,7 @@ <property name="samples.dir" value="${basedir}/samples"/> <property name="sampleslib.dir" value="${samples.dir}/lib"/> <property name="javadoc.dir" value="${basedir}/javadoc"/> + <property name="htdocs.dir" value="${basedir}/htdocs"/> <property name="javac.source" value="1.5"/> <property name="javac.target" value="jsr14"/> <property name="javac.deprecation" value="on"/> @@ -24,6 +25,7 @@ <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> <delete dir="${javadoc.dir}"/> + <delete file="${htdocs.dir}/bugdescriptions.html"/> <delete file="${basedir}/fb-contrib.jar"/> <delete file="${basedir}/fb-contrib-src.zip"/> <delete> @@ -101,6 +103,13 @@ </jar> </target> + <target name="html" depends="-init" description="generates dynamic html"> + <xslt basedir="${etc.dir}" + destdir="${htdocs.dir}" + style="${etc.dir}/bugdescriptions.xsl" + in="${etc.dir}/messages.xml" out="${htdocs.dir}/bugdescriptions.html"/> + </target> + <target name="build" depends="-init, validate_xml, compile, compile_samples, jar" description="builds the plugin jar"> </target> Added: trunk/fb-contrib/etc/bugdescriptions.xsl =================================================================== --- trunk/fb-contrib/etc/bugdescriptions.xsl (rev 0) +++ trunk/fb-contrib/etc/bugdescriptions.xsl 2006-09-11 05:10:23 UTC (rev 643) @@ -0,0 +1,38 @@ +<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:template match="/MessageCollection"> + <html> + <head><title>fb-contrib: Bug Descriptions</title></head> + <body background="true"> + <div style="position:absolute;top:0;left:0;width:256;height:65535;z-index:1;background-image:url(blend.jpg);"> + </div> + + <div style="position:absolute;top:20;left:20;z-index:2;"> + <h1>fb-contrib: Bug Descriptions</h1> + + <table border="1" width="100%"> + <xsl:apply-templates select="BugCode"/> + </table> + </div> + </body> + </html> + </xsl:template> + + <xsl:template match="BugCode"> + <xsl:call-template name="Pattern"> + <xsl:with-param name="abbrev"><xsl:value-of select="@abbrev"/></xsl:with-param> + </xsl:call-template> + </xsl:template> + + <xsl:template name="Pattern"> + <xsl:param name="abbrev"/> + <xsl:for-each select="//BugPattern[starts-with(@type,$abbrev)]"> + <tr><td><b><xsl:value-of select="@type"/></b></td></tr> + <xsl:variable name="desc1"><xsl:value-of select="normalize-space(Details/text())"/></xsl:variable> + <xsl:variable name="desc2"><xsl:value-of select="substring($desc1, 9)"/></xsl:variable> + <xsl:variable name="desc"><xsl:value-of select="substring($desc2, 0, string-length($desc2) - 3)"/></xsl:variable> + <tr><td><xsl:copy-of select="$desc"/></td></tr> + </xsl:for-each> + </xsl:template> + +</xsl:transform> \ No newline at end of file Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2006-09-11 03:58:12 UTC (rev 642) +++ trunk/fb-contrib/htdocs/index.html 2006-09-11 05:10:23 UTC (rev 643) @@ -44,6 +44,8 @@ <a href="http://www.sourceforge.net/projects/fb-contrib">Project Page</a> <img src="vbar.gif" height="12"/> <a href="javadoc/index.html">JavaDoc</a> + <img src="vbar.gif" height="12"/> + <a href="bugdescriptions.html">Bug Descriptions</a> <hr/> <img id="svn_image" src="flip2.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> 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...> - 2006-09-10 16:19:17
|
Revision: 641 http://svn.sourceforge.net/fb-contrib/?rev=641&view=rev Author: dbrosius Date: 2006-09-10 09:18:57 -0700 (Sun, 10 Sep 2006) Log Message: ----------- document PIS Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2006-09-10 03:54:51 UTC (rev 640) +++ trunk/fb-contrib/htdocs/index.html 2006-09-10 16:18:57 UTC (rev 641) @@ -65,6 +65,10 @@ <li><b>[URV] Unrelated Return Values</b><br/> Looks for methods that return Object, and who's code body returns two or more different types of objects that are unrelated (other than by Object).</li> + <li><b>[PIS] Possible Incomplete Synchronization</b><br/> + Looks for classes that don't handle serialization of parent class member fields + when the class in question is serializable but is derived from non serializable + classes.</b><br/> </ul> </div> <hr/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |