Thread: [Fb-contrib-commit] SF.net SVN: fb-contrib:[1073] trunk/fb-contrib
Brought to you by:
dbrosius
From: <dbr...@us...> - 2008-10-05 04:24:39
|
Revision: 1073 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1073&view=rev Author: dbrosius Date: 2008-10-05 03:19:29 +0000 (Sun, 05 Oct 2008) Log Message: ----------- add test SPP_USE_ISEMPTY Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/htdocs/index.html trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2008-08-09 03:34:47 UTC (rev 1072) +++ trunk/fb-contrib/etc/findbugs.xml 2008-10-05 03:19:29 UTC (rev 1073) @@ -256,7 +256,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast" - reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY" /> + reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY" /> <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" @@ -412,6 +412,7 @@ <BugPattern abbrev="SPP" type="SPP_USE_STRINGBUILDER_LENGTH" category="PERFORMANCE" /> <BugPattern abbrev="SPP" type="SPP_INVALID_CALENDAR_COMPARE" category="CORRECTNESS"/> <BugPattern abbrev="SPP" type="SPP_USE_CONTAINSKEY" category="STYLE"/> + <BugPattern abbrev="SPP" type="SPP_USE_ISEMPTY" category="STYLE"/> <BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" /> <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" /> <BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2008-08-09 03:34:47 UTC (rev 1072) +++ trunk/fb-contrib/etc/messages.xml 2008-10-05 03:19:29 UTC (rev 1073) @@ -2026,6 +2026,17 @@ </Details> </BugPattern> + <BugPattern type="SPP_USE_ISEMPTY"> + <ShortDescription>Method checks the size of a collection against zero rather than using isEmpty()</ShortDescription> + <LongDescription>Method {1} checks the size of a collection against zero rather than using isEmpty()</LongDescription> + <Details> + <![CDATA[ + <p>This method calls the size() method on a collection and compares the result to zero to see if the collection + is empty. For better code clarity, it is better to just use col.isEmpty() or !col.isEmpty()</p> + ]]> + </Details> + </BugPattern> + <BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE"> <ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription> <LongDescription>Method {1} assigns a variable in a larger scope then is needed</LongDescription> Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2008-08-09 03:34:47 UTC (rev 1072) +++ trunk/fb-contrib/htdocs/index.html 2008-10-05 03:19:29 UTC (rev 1073) @@ -48,9 +48,9 @@ <a href="bugdescriptions.html">Bug Descriptions</a> <hr/> - <img id="svn_image" src="flip1.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> + <img id="svn_image" src="flip2.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> Detectors added in svn<br/> - <div id="svn" style="display:none;"> + <div id="svn" style="display:block;"> <ul> <li><b>[LO] Logger Oddities</b><br/> Looks for uses of log4j or slf4j where the class specified when creating the logger @@ -62,9 +62,9 @@ </ul> </div> <hr/> - <img id="v3_6_0_image" src="flip2.gif" onClick="toggleBlock('v3_6_0', 'v3_6_0_image');" align="top"/> + <img id="v3_6_0_image" src="flip1.gif" onClick="toggleBlock('v3_6_0', 'v3_6_0_image');" align="top"/> Detectors added in v3.6.0<br/> - <div id="v3_6_0" style="display:block;"> + <div id="v3_6_0" style="display:none;"> <ul> <li><b>[CFS] Confusing Function Semantics</b><br/> Looks for methods that return a parameter after making what looks like Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2008-08-09 03:34:47 UTC (rev 1072) +++ trunk/fb-contrib/samples/SPP_Sample.java 2008-10-05 03:19:29 UTC (rev 1073) @@ -196,4 +196,10 @@ if (m.keySet().contains("Foo")) System.out.println("Yup"); } + + public void testCollectionSizeEqualsZero(Set<String> s) + { + if (s.size() == 0) + System.out.println("empty"); + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2008-08-09 03:34:47 UTC (rev 1072) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2008-10-05 03:19:29 UTC (rev 1073) @@ -52,6 +52,16 @@ */ public class SillynessPotPourri extends BytecodeScanningDetector { + private static final Set<String> collectionInterfaces = new HashSet<String>(); + static { + collectionInterfaces.add("java/util/Collection"); + collectionInterfaces.add("java/util/List"); + collectionInterfaces.add("java/util/Set"); + collectionInterfaces.add("java/util/SortedSet"); + collectionInterfaces.add("java/util/Map"); + collectionInterfaces.add("java/util/SortedMap"); + } + private final BugReporter bugReporter; private OpcodeStack stack; private int lastPCs[]; @@ -155,6 +165,18 @@ } } + if ((seen == IFEQ) || (seen == IFNE)) { + if (stack.getStackDepth() == 1) { + OpcodeStack.Item item = stack.getStackItem(0); + if ("size".equals(item.getUserValue())) { + bugReporter.reportBug(new BugInstance(this, "SPP_USE_ISEMPTY", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } + if (seen == IFNE) { byte[] bytes = getCode().getCode(); if (lastPCs[2] != -1) { @@ -493,6 +515,13 @@ } } } + + if (collectionInterfaces.contains(className)) { + String method = getNameConstantOperand(); + if ("size".equals(method)) { + userValue = "size"; + } + } } } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2008-11-03 07:14:52
|
Revision: 1076 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1076&view=rev Author: dbrosius Date: 2008-11-03 07:14:49 +0000 (Mon, 03 Nov 2008) Log Message: ----------- embellish JAO with tests for Assert.assertNotNull(i) or Assert.assertNotNull(d == 4.3) Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/samples/JAO_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2008-10-30 15:55:38 UTC (rev 1075) +++ trunk/fb-contrib/etc/findbugs.xml 2008-11-03 07:14:49 UTC (rev 1076) @@ -306,7 +306,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.JUnitAssertionOddities" speed="fast" - reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT" /> + reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT,JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousCloneAlgorithm" speed="fast" @@ -430,6 +430,7 @@ <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT" category="STYLE" /> <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE" category="STYLE" /> <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT" category="STYLE" /> + <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" /> <BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" category="CORRECTNESS" /> <BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" /> <BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" experimental="true" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2008-10-30 15:55:38 UTC (rev 1075) +++ trunk/fb-contrib/etc/messages.xml 2008-11-03 07:14:49 UTC (rev 1076) @@ -2261,6 +2261,18 @@ </Details> </BugPattern> + <BugPattern type="JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL"> + <ShortDescription>method asserts that an auto-boxed value is not null</ShortDescription> + <LongDescription>method {1} asserts that an auto-boxed value is not null</LongDescription> + <Details> + <![CDATA[ + <p>This method asserts that a primitive value that was autoboxed into a boxed primitive was not + null. This will never happen, as primitives are never null, and thus the autoboxed value isn't + either.</p> + ]]> + </Details> + </BugPattern> + <BugPattern type="SCA_SUSPICIOUS_CLONE_ALGORITHM"> <ShortDescription>clone method stores a new value to member field of source object</ShortDescription> <LongDescription>clone method {1} stores a new value to member field of source object</LongDescription> Modified: trunk/fb-contrib/samples/JAO_Sample.java =================================================================== --- trunk/fb-contrib/samples/JAO_Sample.java 2008-10-30 15:55:38 UTC (rev 1075) +++ trunk/fb-contrib/samples/JAO_Sample.java 2008-11-03 07:14:49 UTC (rev 1076) @@ -24,4 +24,10 @@ { Assert.assertEquals(i, 10); } + + public void testAutoBoxNotNull(int i) + { + Assert.assertNotNull(i); + Assert.assertNotNull(i == 3); + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2008-10-30 15:55:38 UTC (rev 1075) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2008-11-03 07:14:49 UTC (rev 1076) @@ -130,6 +130,8 @@ @Override public void sawOpcode(int seen) { + String userValue = null; + try { stack.mergeJumps(this); @@ -171,11 +173,32 @@ } } } + } else if ("assertNotNull".equals(methodName)) { + if (stack.getStackDepth() > 0) { + if ("valueOf".equals(stack.getStackItem(0).getUserValue())) { + bugReporter.reportBug(new BugInstance(this, "JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } } + } else { + String methodName = getNameConstantOperand(); + String sig = getSigConstantOperand(); + if (clsName.startsWith("java/lang/") + && "valueOf".equals(methodName) + && (sig.indexOf(")Ljava/lang/") >= 0)) { + userValue = "valueOf"; + } } } } finally { stack.sawOpcode(this, seen); + if ((userValue != null) && (stack.getStackDepth() > 0)) { + OpcodeStack.Item item = stack.getStackItem(0); + item.setUserValue(userValue); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-02-14 16:30:34
|
Revision: 1088 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1088&view=rev Author: dbrosius Date: 2009-02-14 16:30:31 +0000 (Sat, 14 Feb 2009) Log Message: ----------- add check for System.getProperties().getProperty("foo") Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-02-14 05:08:05 UTC (rev 1087) +++ trunk/fb-contrib/etc/findbugs.xml 2009-02-14 16:30:31 UTC (rev 1088) @@ -256,7 +256,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast" - reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY" /> + reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY" /> <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" @@ -413,6 +413,7 @@ <BugPattern abbrev="SPP" type="SPP_INVALID_CALENDAR_COMPARE" category="CORRECTNESS"/> <BugPattern abbrev="SPP" type="SPP_USE_CONTAINSKEY" category="STYLE"/> <BugPattern abbrev="SPP" type="SPP_USE_ISEMPTY" category="STYLE"/> + <BugPattern abbrev="SPP" type="SPP_USE_GETPROPERTY" category="STYLE"/> <BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" /> <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" /> <BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-02-14 05:08:05 UTC (rev 1087) +++ trunk/fb-contrib/etc/messages.xml 2009-02-14 16:30:31 UTC (rev 1088) @@ -2037,6 +2037,21 @@ </Details> </BugPattern> + <BugPattern type="SPP_USE_GETPROPERTY"> + <ShortDescription>Method calls getProperties just to get one property, use getProperty instead</ShortDescription> + <LongDescription>Method {1} calls getProperties just to get one property, use getProperty instead</LongDescription> + <Details> + <![CDATA[ + <table> + <tr><td>This method uses</td></tr> + <tr><td>String prop = System.getProperties().getProperty("foo");</td></tr + <tr><td>instead of simply using</td></tr> + <tr><td>String prop = System.getProperty("foo");</td></tr> + </table> + ]]> + </Details> + </BugPattern> + <BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE"> <ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription> <LongDescription>Method {1} assigns a variable in a larger scope then is needed</LongDescription> Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2009-02-14 05:08:05 UTC (rev 1087) +++ trunk/fb-contrib/samples/SPP_Sample.java 2009-02-14 16:30:31 UTC (rev 1088) @@ -2,6 +2,7 @@ import java.util.BitSet; import java.util.Calendar; import java.util.Date; +import java.util.GregorianCalendar; import java.util.HashSet; import java.util.Iterator; import java.util.Map; @@ -202,4 +203,17 @@ if (s.size() == 0) System.out.println("empty"); } + + public boolean testDerivedGregorianCalendar() + { + Calendar c = new GregorianCalendar() {}; + Calendar s = new GregorianCalendar(); + + return s.after(c); + } + + public void testGetProperties() + { + String lf = System.getProperties().getProperty("line.separator"); + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-02-14 05:08:05 UTC (rev 1087) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-02-14 16:30:31 UTC (rev 1088) @@ -358,6 +358,13 @@ .addSourceLine(this)); } } + } else if (seen == INVOKESTATIC) { + String className = getClassConstantOperand(); + String methodName = getNameConstantOperand(); + if ("java/lang/System".equals(className)) { + if ("getProperties".equals(methodName)) + userValue = "getProperties"; + } } else if (seen == INVOKEVIRTUAL) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); @@ -457,6 +464,18 @@ } } + } else if ("java/util/Properties".equals(className)) { + if (("get".equals(methodName) || "getProperty".equals(methodName))) { + if (stack.getStackDepth() > 1) { + OpcodeStack.Item item = stack.getStackItem(1); + if ("getProperties".equals(item.getUserValue())) { + bugReporter.reportBug(new BugInstance(this, "SPP_USE_GETPROPERTY", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } } } else if (seen == INVOKESPECIAL) { String className = getClassConstantOperand(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-02-14 16:33:30
|
Revision: 1089 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1089&view=rev Author: dbrosius Date: 2009-02-14 16:33:26 +0000 (Sat, 14 Feb 2009) Log Message: ----------- prepare for a 3.6.2 release Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2009-02-14 16:30:31 UTC (rev 1088) +++ trunk/fb-contrib/build.xml 2009-02-14 16:33:26 UTC (rev 1089) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="3.7.0"/> + <property name="fb-contrib.version" value="3.6.2"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-02-14 16:30:31 UTC (rev 1088) +++ trunk/fb-contrib/etc/findbugs.xml 2009-02-14 16:33:26 UTC (rev 1089) @@ -318,11 +318,13 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousClusteredSessionSupport" speed="fast" - reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" /> + reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" + hidden="true" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" speed="fast" - reports="LO_SUSPECT_LOG_CLASS" /> + reports="LO_SUSPECT_LOG_CLASS" + hidden="true" /> <!-- BugPattern --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-02-14 16:52:02
|
Revision: 1091 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1091&view=rev Author: dbrosius Date: 2009-02-14 16:51:59 +0000 (Sat, 14 Feb 2009) Log Message: ----------- go back to 3.7.0 dev Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2009-02-14 16:37:21 UTC (rev 1090) +++ trunk/fb-contrib/build.xml 2009-02-14 16:51:59 UTC (rev 1091) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="3.6.2"/> + <property name="fb-contrib.version" value="3.7.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-02-14 16:37:21 UTC (rev 1090) +++ trunk/fb-contrib/etc/findbugs.xml 2009-02-14 16:51:59 UTC (rev 1091) @@ -318,13 +318,11 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousClusteredSessionSupport" speed="fast" - reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" - hidden="true" /> + reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" speed="fast" - reports="LO_SUSPECT_LOG_CLASS" - hidden="true" /> + reports="LO_SUSPECT_LOG_CLASS" /> <!-- BugPattern --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-02-20 05:22:51
|
Revision: 1093 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1093&view=rev Author: dbrosius Date: 2009-02-20 05:22:46 +0000 (Fri, 20 Feb 2009) Log Message: ----------- add detector IICU Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml Added Paths: ----------- trunk/fb-contrib/samples/IICU_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-02-16 01:04:37 UTC (rev 1092) +++ trunk/fb-contrib/etc/findbugs.xml 2009-02-20 05:22:46 UTC (rev 1093) @@ -324,6 +324,10 @@ speed="fast" reports="LO_SUSPECT_LOG_CLASS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" + speed="fast" + reports="IICU_INCORRECT_INTERNAL_CLASS_USE" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -436,4 +440,5 @@ <BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" /> <BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-02-16 01:04:37 UTC (rev 1092) +++ trunk/fb-contrib/etc/messages.xml 2009-02-20 05:22:46 UTC (rev 1093) @@ -890,6 +890,16 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse"> + <Details> + <![CDATA[ + <p>looks for classes that rely on sun internal classes in the package com.sun.xxxx. As these classes + are not officially released from sun, they are subject to change or removal, and thus, + should not be counted on.</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -2336,6 +2346,18 @@ </Details> </BugPattern> + <BugPattern type="IICU_INCORRECT_INTERNAL_CLASS_USE"> + <ShortDescription>class relies on internal sun classes</ShortDescription> + <LongDescription>class {0} relies on internal sun classes</LongDescription> + <Details> + <![CDATA[ + <p>This class makes use of internal sun classes in the package com.sun.xxx. As these + classes are not documented, nor externally released as part of the api, they are subject + to change or removal. You should not be using these classes.</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2411,4 +2433,5 @@ <BugCode abbrev="WEM">Weak Exception Messaging</BugCode> <BugCode abbrev="SCSS">Suspicious Clustered Session Support</BugCode> <BugCode abbrev="LO">Logger Oddities</BugCode> + <BugCode abbrev="IICU">Incorrect Internal Class use</BugCode> </MessageCollection> \ No newline at end of file Added: trunk/fb-contrib/samples/IICU_Sample.java =================================================================== --- trunk/fb-contrib/samples/IICU_Sample.java (rev 0) +++ trunk/fb-contrib/samples/IICU_Sample.java 2009-02-20 05:22:46 UTC (rev 1093) @@ -0,0 +1,12 @@ +import javax.xml.datatype.XMLGregorianCalendar; + +import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl; + + +public class IICU_Sample +{ + public void test() + { + XMLGregorianCalendar cal = new XMLGregorianCalendarImpl(); + } +} Property changes on: trunk/fb-contrib/samples/IICU_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2009-02-20 05:22:46 UTC (rev 1093) @@ -0,0 +1,73 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2009 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 org.apache.bcel.classfile.Constant; +import org.apache.bcel.classfile.ConstantClass; +import org.apache.bcel.classfile.ConstantPool; +import org.apache.bcel.classfile.JavaClass; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.Detector; +import edu.umd.cs.findbugs.ba.ClassContext; + +/** + * looks for classes that use objects from com.sun.xxx packages. As these are internal + * to sun and subject to change, this should not be done. + */ +public class IncorrectInternalClassUse implements Detector +{ + private final BugReporter bugReporter; + + /** + * constructs a IICU detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ + public IncorrectInternalClassUse(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + /** + * implements the visitor to look for classes that reference com.sun.xxx classes + * by looking for class constants in the constant pool + * + * @param classContext the context object of the currently parsed class + */ + public void visitClassContext(ClassContext context) { + JavaClass cls = context.getJavaClass(); + if (!cls.getClassName().startsWith("com/sun/")) { + ConstantPool pool = cls.getConstantPool(); + int numItems = pool.getLength(); + for (int i = 0; i < numItems; i++) { + Constant c = pool.getConstant(i); + if (c instanceof ConstantClass) { + String clsName = ((ConstantClass) c).getBytes(pool); + if (clsName.startsWith("com/sun/")) { + bugReporter.reportBug(new BugInstance(this, "IICU_INCORRECT_INTERNAL_CLASS_USE", NORMAL_PRIORITY) + .addClass(cls) + .addString(clsName)); + } + } + } + } + } + + public void report() { + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-02-21 08:18:12
|
Revision: 1098 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1098&view=rev Author: dbrosius Date: 2009-02-21 08:18:02 +0000 (Sat, 21 Feb 2009) Log Message: ----------- add org.apache.xerces to the list of internal packages Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-02-21 06:01:17 UTC (rev 1097) +++ trunk/fb-contrib/etc/messages.xml 2009-02-21 08:18:02 UTC (rev 1098) @@ -893,9 +893,14 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse"> <Details> <![CDATA[ - <p>looks for classes that rely on sun internal classes in the package com.sun.xxxx. As these classes - are not officially released from sun, they are subject to change or removal, and thus, + <p>looks for classes that rely on internal classes in the various apis or libraries. As these + classes are not officially released from the api vendor, they are subject to change or removal, and thus, should not be counted on.</p> + Packages that shouldn't be used are: + <ul> + <li>com.sun.xxx</li> + <li>org.apache.xerces.xxx</li> + </ul> ]]> </Details> </Detector> @@ -2347,13 +2352,18 @@ </BugPattern> <BugPattern type="IICU_INCORRECT_INTERNAL_CLASS_USE"> - <ShortDescription>class relies on internal sun classes</ShortDescription> - <LongDescription>class {0} relies on internal sun classes</LongDescription> + <ShortDescription>class relies on internal api classes</ShortDescription> + <LongDescription>class {0} relies on internal api classes</LongDescription> <Details> <![CDATA[ - <p>This class makes use of internal sun classes in the package com.sun.xxx. As these + <p>This class makes use of internal api classes. As these classes are not documented, nor externally released as part of the api, they are subject to change or removal. You should not be using these classes.</p> + Packages that shouldn't be used are: + <ul> + <li>com.sun.xxx</li> + <li>org.apache.xerces.xxx</li> + </ul> ]]> </Details> </BugPattern> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2009-02-21 06:01:17 UTC (rev 1097) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2009-02-21 08:18:02 UTC (rev 1098) @@ -38,8 +38,11 @@ { private final BugReporter bugReporter; private static final Set<String> internalPackages = new HashSet<String>(); + private static final Set<String> externalPackages = new HashSet<String>(); static { internalPackages.add("com/sun/"); + internalPackages.add("org/apache/xerces/"); + externalPackages.add("org/apache/xerces/xni/"); } /** @@ -51,7 +54,7 @@ } /** - * implements the visitor to look for classes that reference com.sun.xxx classes + * implements the visitor to look for classes that reference com.sun.xxx, or org.apache.xerces.xxx classes * by looking for class constants in the constant pool * * @param classContext the context object of the currently parsed class @@ -88,11 +91,23 @@ * @returns whether the class is internal */ private boolean isInternal(String clsName) { + boolean internal = false; for (String internalPackage : internalPackages) { - if (clsName.startsWith(internalPackage)) - return true; + if (clsName.startsWith(internalPackage)) { + internal = true; + break; + } } - return false; + if (internal) { + for (String externalPackage : externalPackages) { + if (clsName.startsWith(externalPackage)) { + internal = false; + break; + } + } + } + + return internal; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-03-01 03:20:46
|
Revision: 1118 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1118&view=rev Author: dbrosius Date: 2009-03-01 03:20:41 +0000 (Sun, 01 Mar 2009) Log Message: ----------- tighten up UAA, fix 1934619 Modified Paths: -------------- trunk/fb-contrib/samples/UAA_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java Modified: trunk/fb-contrib/samples/UAA_Sample.java =================================================================== --- trunk/fb-contrib/samples/UAA_Sample.java 2009-02-28 04:17:09 UTC (rev 1117) +++ trunk/fb-contrib/samples/UAA_Sample.java 2009-03-01 03:20:41 UTC (rev 1118) @@ -1,4 +1,3 @@ -import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -8,8 +7,8 @@ public class UAA_Sample { - private Set<String> in = new HashSet<String>(); - private Set<String> out = new HashSet<String>(); + private final Set<String> in = new HashSet<String>(); + private final Set<String> out = new HashSet<String>(); public Set<String> testLocalSet(Set<String> in) { Set<String> out = new HashSet<String>(); @@ -88,4 +87,28 @@ System.out.println("Hmm"); } } + + public void testFP1934619_A(final List<String> out, final Set<String> currentParents) + { + for (String currentOid : currentParents) + { + out.add(currentOid); + if (currentOid.indexOf("xx") > -1) { + continue; + } + out.add("don't forget me"); + } + } + + public void testFP1934619_B(final List<String> out, final Set<String> currentParents) + { + for (String currentOid : currentParents) + { + if (currentOid.indexOf("xx") > -1) + { + throw new RuntimeException("enough is enough"); + } + out.add(currentOid); + } + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java 2009-02-28 04:17:09 UTC (rev 1117) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java 2009-03-01 03:20:41 UTC (rev 1118) @@ -54,7 +54,7 @@ } } - private BugReporter bugReporter; + private final BugReporter bugReporter; private OpcodeStack stack; /** register/field to alias register/field */ private Map<Comparable<?>, Comparable<?>> userValues; @@ -138,6 +138,8 @@ .addSourceLine(this, loopPC)); } it.remove(); + } else if ((loop.getEndPC() > pc) && (loop.addPC < (pc - 5)) && (loop.addPC > 0)) { + it.remove(); } } @@ -185,9 +187,7 @@ if (uValue != null) { LoopInfo loop = loops.get(uValue); if (loop != null) { - if (loop.inConditionalRange(pc)) - loop.foundAdd(-1); - else if (loop.isInLoop(pc, false)) { + if (loop.isInLoop(pc)) { if (this.getCodeByte(getNextPC()) == POP) { loop.foundAdd(pc); } @@ -202,12 +202,11 @@ if (uValue != null) { LoopInfo loop = loops.get(uValue); if (loop != null) { - if (loop.inConditionalRange(pc)) - loop.foundAdd(-1); - else if (loop.isInLoop(pc, false)) + if (loop.isInLoop(pc)) { if (this.getCodeByte(getNextPC()) == POP) { loop.foundAdd(pc); } + } } } } @@ -244,12 +243,8 @@ } } - if (!loopFound) - { - LoopInfo loop = findLoop(pc, true); - if (loop != null) { - loop.addConditionalRange(pc, getBranchTarget()); - } + if (!loopFound) { + removeLoop(pc); } } } @@ -269,10 +264,7 @@ } } } else if (((seen > IFEQ) && (seen <= GOTO)) || (seen == IFNULL) || (seen == IFNONNULL)) { - LoopInfo loop = findLoop(pc, true); - if (loop != null) { - loop.addConditionalRange(pc, getBranchOffset() > 0 ? getBranchTarget() : loop.end); - } + removeLoop(pc); } else if (seen == CHECKCAST) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); @@ -359,21 +351,29 @@ return null; } - private LoopInfo findLoop(int pc, boolean ignoreConditionals) { + private LoopInfo findLoop(int pc) { for (LoopInfo loop : loops.values()) { - if (loop.isInLoop(pc, ignoreConditionals)) + if (loop.isInLoop(pc)) return loop; } return null; } + private void removeLoop(int pc) { + Iterator<LoopInfo> it = loops.values().iterator(); + while (it.hasNext()) { + if (it.next().isInLoop(pc)) { + it.remove(); + } + } + } + static class LoopInfo { - private int start; - private int end; + private final int start; + private final int end; private int addPC; - private Map<Integer, Integer> conditionalRanges = new HashMap<Integer, Integer>(); public LoopInfo(int loopStart, int loopEnd) { @@ -381,33 +381,12 @@ end = loopEnd; addPC = 0; } - - public void addConditionalRange(int condStart, int condEnd) + + public boolean isInLoop(int pc) { - conditionalRanges.put(Integer14.valueOf(condStart), Integer14.valueOf(condEnd)); + return ((pc >= start) && (pc <= end)); } - public boolean inConditionalRange(int pc) { - for (Map.Entry<Integer, Integer> entry : conditionalRanges.entrySet()) - { - if ((pc >= entry.getKey().intValue()) && pc <= entry.getValue().intValue()) - return true; - } - - return false; - } - - public boolean isInLoop(int pc, boolean ignoreConditionals) - { - if ((pc < start) || (pc > end)) - return false; - - if (ignoreConditionals) - return true; - - return !inConditionalRange(pc); - } - public void foundAdd(int pc) { if (addPC == 0) addPC = pc; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-03-01 04:38:43
|
Revision: 1120 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1120&view=rev Author: dbrosius Date: 2009-03-01 04:38:40 +0000 (Sun, 01 Mar 2009) Log Message: ----------- prepare for the 3.8.0 release Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2009-03-01 04:32:40 UTC (rev 1119) +++ trunk/fb-contrib/build.xml 2009-03-01 04:38:40 UTC (rev 1120) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="3.7.0"/> + <property name="fb-contrib.version" value="3.8.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 2009-03-01 04:32:40 UTC (rev 1119) +++ trunk/fb-contrib/htdocs/index.html 2009-03-01 04:38:40 UTC (rev 1120) @@ -48,9 +48,9 @@ <a href="bugdescriptions.html">Bug Descriptions</a> <hr/> - <img id="svn_image" src="flip2.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> - Detectors added in svn<br/> - <div id="svn" style="display:block;"> + <img id="v3_8_0_image" src="flip2.gif" onClick="toggleBlock('v3_8_0', 'v3_8_0_image');" align="top"/> + Detectors added in v3.8.0<br/> + <div id="v3_8_0" style="display:block;"> <ul> <li><b>[DSOC] Dubious Set of Collections</b><br/> Looks for sets or keySets of maps that contain other collections. As typically collections calculate This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-03-01 08:54:38
|
Revision: 1129 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1129&view=rev Author: dbrosius Date: 2009-03-01 08:54:28 +0000 (Sun, 01 Mar 2009) Log Message: ----------- new BED Detector Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml Added Paths: ----------- trunk/fb-contrib/samples/BED_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-03-01 07:39:25 UTC (rev 1128) +++ trunk/fb-contrib/etc/findbugs.xml 2009-03-01 08:54:28 UTC (rev 1129) @@ -332,6 +332,10 @@ speed="moderate" reports="DSOC_DUBIOUS_SET_OF_COLLECTIONS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.BogusExceptionDeclaration" + speed="moderate" + reports="BED_BOGUS_EXCEPTION_DECLARATION" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -442,8 +446,9 @@ <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" /> <BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" category="CORRECTNESS" /> <BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" /> - <BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="DSOC" type="DSOC_DUBIOUS_SET_OF_COLLECTIONS" category="PERFORMANCE" experimental="true" /> + <BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" /> + <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" category="CORRECTNESS" /> + <BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" category="CORRECTNESS" /> + <BugPattern abbrev="DSOC" type="DSOC_DUBIOUS_SET_OF_COLLECTIONS" category="PERFORMANCE" /> + <BugPattern abbrev="BED" type="BED_BOGUS_EXCEPTION_DECLARATION" category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-03-01 07:39:25 UTC (rev 1128) +++ trunk/fb-contrib/etc/messages.xml 2009-03-01 08:54:28 UTC (rev 1129) @@ -924,6 +924,17 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.BogusExceptionDeclaration"> + <Details> + <![CDATA[ + <p>looks for constructors, static methods and private methods that declare that they throw + checked exceptions that the actual code never throws. Since these methods can't be overridden, + there is no reason to add these exceptions to the method declaration.</p> + <p>It is a moderately fast detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -2407,6 +2418,19 @@ </Details> </BugPattern> + <BugPattern type="BED_BOGUS_EXCEPTION_DECLARATION"> + <ShortDescription>non derivable method declares throwing an exception that isn't thrown</ShortDescription> + <LongDescription>non derivable method {1} declares throwing an exception that isn't thrown</LongDescription> + <Details> + <![CDATA[ + <p>This method declares that it throws a checked exception that it does not throw. As this method is + either a constructor, static method or private method, there is no reason for this method to declare + the exception in it's throws clause, and just causes calling methods to unnecessarily handle an exception + that will never be thrown. The exception in question should be removed from the throws clause.</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2484,4 +2508,5 @@ <BugCode abbrev="LO">Logger Oddities</BugCode> <BugCode abbrev="IICU">Incorrect Internal Class use</BugCode> <BugCode abbrev="DSOC">Dubious Set of Collections</BugCode> + <BugCode abbrev="BED">Bogus Exception Declaration</BugCode> </MessageCollection> \ No newline at end of file Added: trunk/fb-contrib/samples/BED_Sample.java =================================================================== --- trunk/fb-contrib/samples/BED_Sample.java (rev 0) +++ trunk/fb-contrib/samples/BED_Sample.java 2009-03-01 08:54:28 UTC (rev 1129) @@ -0,0 +1,22 @@ +import java.io.IOException; +import java.sql.SQLException; +import java.util.zip.DataFormatException; + + +public class BED_Sample +{ + public BED_Sample() throws IOException + { + + } + + private void badThrow() throws SQLException + { + + } + + public static void badStatic() throws DataFormatException + { + + } +} Property changes on: trunk/fb-contrib/samples/BED_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2009-03-01 08:54:28 UTC (rev 1129) @@ -0,0 +1,113 @@ +package com.mebigfatguy.fbcontrib.detect; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.bcel.Repository; +import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.ExceptionTable; +import org.apache.bcel.classfile.JavaClass; +import org.apache.bcel.classfile.Method; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.BytecodeScanningDetector; +import edu.umd.cs.findbugs.ba.ClassContext; +import edu.umd.cs.findbugs.ba.XMethod; + +/** + * looks for constructors, private methods or static methods that declare that they + * throw specific checked exceptions, but that do not. This just causes callers of + * these methods to do extra work to handle an exception that will never be thrown. + */ +public class BogusExceptionDeclaration extends BytecodeScanningDetector { + private static JavaClass runtimeExceptionClass; + static { + try { + runtimeExceptionClass = Repository.lookupClass("java/lang/RuntimeException"); + } catch (ClassNotFoundException cnfe) { + runtimeExceptionClass = null; + } + } + private final BugReporter bugReporter; + private Set<String> declaredCheckedExceptions; + + public BogusExceptionDeclaration(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + + @Override + public void visitClassContext(ClassContext classContext) { + try { + if (runtimeExceptionClass != null) { + declaredCheckedExceptions = new HashSet<String>(); + super.visitClassContext(classContext); + } + } finally { + declaredCheckedExceptions = null; + } + } + + /** + * implements the visitor to see if the method declares that it throws any + * checked exceptions. + * + * @param obj the context object of the currently parsed code block + */ + @Override + public void visitCode(Code obj) { + Method method = getMethod(); + if (method.isStatic() || method.isPrivate() || "<init>".equals(method.getName())) { + ExceptionTable et = method.getExceptionTable(); + if (et != null) { + String[] exNames = et.getExceptionNames(); + for (String exName : exNames) { + try { + JavaClass exCls = Repository.lookupClass(exName); + if (!exCls.instanceOf(runtimeExceptionClass)) { + declaredCheckedExceptions.add(exName); + } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); + } + } + if (!declaredCheckedExceptions.isEmpty()) { + super.visitCode(obj); + if (!declaredCheckedExceptions.isEmpty()) { + BugInstance bi = new BugInstance(this, "BED_BOGUS_EXCEPTION_DECLARATION", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this, 0); + for (String ex : declaredCheckedExceptions) { + bi.addString(ex.replaceAll("/", ".")); + } + bugReporter.reportBug(bi); + } + } + } + } + } + + /** + * implements the visitor to look for method calls that could throw the exceptions + * that are listed in the declaration. + */ + @Override + public void sawOpcode(int seen) { + if (declaredCheckedExceptions.isEmpty()) { + return; + } + + if ((seen == INVOKEVIRTUAL) + || (seen == INVOKEINTERFACE) + || (seen == INVOKESPECIAL) + || (seen == INVOKESTATIC)) { + XMethod method = getXMethod(); + String[] thrownExceptions = method.getThrownExceptions(); + for (String thrownException : thrownExceptions) { + declaredCheckedExceptions.remove(thrownException.replaceAll("/", ".")); + } + } + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-03-16 03:59:56
|
Revision: 1144 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1144&view=rev Author: dbrosius Date: 2009-03-16 03:59:42 +0000 (Mon, 16 Mar 2009) Log Message: ----------- get ready for 3.8.1 Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/samples/LEST_Sample.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2009-03-16 03:09:24 UTC (rev 1143) +++ trunk/fb-contrib/build.xml 2009-03-16 03:59:42 UTC (rev 1144) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="3.9.0"/> + <property name="fb-contrib.version" value="3.8.1"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-03-16 03:09:24 UTC (rev 1143) +++ trunk/fb-contrib/etc/findbugs.xml 2009-03-16 03:59:42 UTC (rev 1144) @@ -334,7 +334,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BogusExceptionDeclaration" speed="moderate" - reports="BED_BOGUS_EXCEPTION_DECLARATION" /> + reports="BED_BOGUS_EXCEPTION_DECLARATION" + hidden="true" /> <!-- BugPattern --> Modified: trunk/fb-contrib/samples/LEST_Sample.java =================================================================== --- trunk/fb-contrib/samples/LEST_Sample.java 2009-03-16 03:09:24 UTC (rev 1143) +++ trunk/fb-contrib/samples/LEST_Sample.java 2009-03-16 03:59:42 UTC (rev 1144) @@ -101,6 +101,19 @@ } } + public void testLestFP6(String s) throws Exception + { + double d; + try + { + d = Double.parseDouble(s); + } + finally + { + throw new Exception("Yikes"); + } + } + private Exception wrap(Exception e) { return new Exception(e); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-03-16 04:12:25
|
Revision: 1146 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1146&view=rev Author: dbrosius Date: 2009-03-16 04:12:15 +0000 (Mon, 16 Mar 2009) Log Message: ----------- go back to 3.9.0 development Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2009-03-16 04:01:14 UTC (rev 1145) +++ trunk/fb-contrib/build.xml 2009-03-16 04:12:15 UTC (rev 1146) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="3.8.1"/> + <property name="fb-contrib.version" value="3.9.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-03-16 04:01:14 UTC (rev 1145) +++ trunk/fb-contrib/etc/findbugs.xml 2009-03-16 04:12:15 UTC (rev 1146) @@ -334,8 +334,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BogusExceptionDeclaration" speed="moderate" - reports="BED_BOGUS_EXCEPTION_DECLARATION" - hidden="true" /> + reports="BED_BOGUS_EXCEPTION_DECLARATION" /> <!-- BugPattern --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-03-18 20:35:36
|
Revision: 1149 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1149&view=rev Author: dbrosius Date: 2009-03-18 20:34:57 +0000 (Wed, 18 Mar 2009) Log Message: ----------- add SPP check for non private serialVersionUID fields Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-03-17 06:36:26 UTC (rev 1148) +++ trunk/fb-contrib/etc/findbugs.xml 2009-03-18 20:34:57 UTC (rev 1149) @@ -426,6 +426,7 @@ <BugPattern abbrev="SPP" type="SPP_USE_CONTAINSKEY" category="STYLE"/> <BugPattern abbrev="SPP" type="SPP_USE_ISEMPTY" category="STYLE"/> <BugPattern abbrev="SPP" type="SPP_USE_GETPROPERTY" category="STYLE"/> + <BugPattern abbrev="SPP" type="SPP_SERIALVER_SHOULD_BE_PRIVATE" category="STYLE"/> <BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" /> <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" /> <BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-03-17 06:36:26 UTC (rev 1148) +++ trunk/fb-contrib/etc/messages.xml 2009-03-18 20:34:57 UTC (rev 1149) @@ -2097,6 +2097,19 @@ </Details> </BugPattern> + <BugPattern type="SPP_SERIALVER_SHOULD_BE_PRIVATE"> + <ShortDescription>Class defines a serialVersionUID as non private</ShortDescription> + <LongDescription>Class {0} defines a serialVersionUID as non private</LongDescription> + <Details> + <![CDATA[ + This class defines a static field 'serialVersionUID' to define the serialization + version for this class. This field is marked as non private. As the serialVersionUID only + controls the current class, and doesn't effect any derived classes, defining it as non + private is confusing. It is suggested you change this variable to be private. + ]]> + </Details> + </BugPattern> + <BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE"> <ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription> <LongDescription>Method {1} assigns a variable in a larger scope then is needed</LongDescription> Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2009-03-17 06:36:26 UTC (rev 1148) +++ trunk/fb-contrib/samples/SPP_Sample.java 2009-03-18 20:34:57 UTC (rev 1149) @@ -1,3 +1,4 @@ +import java.io.Serializable; import java.math.BigDecimal; import java.util.BitSet; import java.util.Calendar; @@ -9,9 +10,11 @@ import java.util.Set; import java.util.StringTokenizer; -public class SPP_Sample +public class SPP_Sample implements Serializable { - private static final double pi = 3.14; + public static final long serialVersionUID = -2766574418713802220L; + + private static final double pi = 3.14; private static final double e = 2.72; public static final String FALSE_POSITIVE = "INTERN_OK_HERE".intern(); @@ -47,13 +50,17 @@ public void testNAN(double d) { if (d == Double.NaN) - System.out.println("It's a nan"); + { + System.out.println("It's a nan"); + } } public void testNAN(float f) { if (f == Float.NaN) - System.out.println("It's a nan"); + { + System.out.println("It's a nan"); + } } public void testBigDecimal() @@ -69,21 +76,29 @@ public void equalsOnEnum(Flap f) { if (f.equals(Flap.Jack)) - System.out.println("Flap Jacks"); + { + System.out.println("Flap Jacks"); + } } public void testCPPBoolean(Boolean a, Boolean b, Boolean c, Boolean d, Boolean e) { if (b && b.booleanValue()) - System.out.println("Booya"); + { + System.out.println("Booya"); + } if (e && e.booleanValue()) - System.out.println("Booya"); + { + System.out.println("Booya"); + } } public char usechatAt(String s) { if (s.length() > 0) - return s.toCharArray()[0]; + { + return s.toCharArray()[0]; + } return ' '; } @@ -95,7 +110,9 @@ public boolean testFPUselessTrinary(boolean a, boolean b) { if (a && b) - return a || b; + { + return a || b; + } return a && b; } @@ -111,18 +128,30 @@ String e = "Foo"; if ((s == null) || (s.length() > 0)) - System.out.println("Booya"); + { + System.out.println("Booya"); + } if ((s == null) || (s.length() != 0)) - System.out.println("Booya"); + { + System.out.println("Booya"); + } if ((s != null) && (s.length() == 0)) - System.out.println("Booya"); + { + System.out.println("Booya"); + } if ((e == null) || (e.length() > 0)) + { System.out.println("Booya"); + } if ((e == null) || (e.length() != 0)) + { System.out.println("Booya"); + } if ((e != null) && (e.length() == 0)) + { System.out.println("Booya"); + } } public void testFPSST(String s) @@ -131,22 +160,34 @@ String e = "Foo"; if ((s == null) || (s.length() == 0)) + { System.out.println("Booya"); + } if ((s != null) && (s.length() >= 0)) + { System.out.println("Booya"); + } if ((s != null) && (s.length() != 0)) + { System.out.println("Booya"); + } if ((e == null) || (e.length() == 0)) + { System.out.println("Booya"); + } if ((e != null) && (e.length() >= 0)) + { System.out.println("Booya"); + } if ((e != null) && (e.length() != 0)) + { System.out.println("Booya"); + } Set<String> m = new HashSet<String>(); Iterator<String> it = m.iterator(); @@ -165,9 +206,13 @@ public void sbToString(StringBuffer sb) { if (sb.toString().length() == 0) - System.out.println("Booya"); - else if (sb.toString().equals("")) - System.out.println("Booya"); + { + System.out.println("Booya"); + } + else if (sb.toString().equals("")) + { + System.out.println("Booya"); + } } public String cpNullOrZero(StringTokenizer tokenizer) @@ -195,13 +240,17 @@ public void testUseContainsKey(Map m) { if (m.keySet().contains("Foo")) - System.out.println("Yup"); + { + System.out.println("Yup"); + } } public void testCollectionSizeEqualsZero(Set<String> s) { if (s.size() == 0) - System.out.println("empty"); + { + System.out.println("empty"); + } } public boolean testDerivedGregorianCalendar() Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-03-17 06:36:26 UTC (rev 1148) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-03-18 20:34:57 UTC (rev 1149) @@ -32,6 +32,7 @@ import org.apache.bcel.classfile.ConstantNameAndType; import org.apache.bcel.classfile.ConstantPool; import org.apache.bcel.classfile.ConstantString; +import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.LocalVariable; import org.apache.bcel.classfile.LocalVariableTable; @@ -90,6 +91,17 @@ } @Override + public void visitField(Field field) { + if ("serialVersionUID".equals(field.getName()) + && ((field.getAccessFlags() & ACC_STATIC) != 0) + && ((field.getAccessFlags() & ACC_PRIVATE) == 0)) { + bugReporter.reportBug(new BugInstance(this, "SPP_SERIALVER_SHOULD_BE_PRIVATE", LOW_PRIORITY) + .addClass(this) + .addField(this)); + } + } + + @Override public void visitClassContext(ClassContext classContext) { try { stack = new OpcodeStack(); @@ -264,10 +276,14 @@ boolean bug = true; Set<Integer> branchInsSet = branchTargets.get(Integer14.valueOf(lastPCs[1])); if (branchInsSet != null) - bug = false; + { + bug = false; + } branchInsSet = branchTargets.get(Integer14.valueOf(lastPCs[3])); if ((branchInsSet != null) && branchInsSet.size() > 1) - bug = false; + { + bug = false; + } if (bug) { bugReporter.reportBug(new BugInstance(this, "SPP_USELESS_TRINARY", NORMAL_PRIORITY) @@ -363,7 +379,9 @@ String methodName = getNameConstantOperand(); if ("java/lang/System".equals(className)) { if ("getProperties".equals(methodName)) - userValue = "getProperties"; + { + userValue = "getProperties"; + } } } else if (seen == INVOKEVIRTUAL) { String className = getClassConstantOperand(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-04-11 02:50:20
|
Revision: 1153 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1153&view=rev Author: dbrosius Date: 2009-04-11 02:50:18 +0000 (Sat, 11 Apr 2009) Log Message: ----------- new UNNC detector Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml Added Paths: ----------- trunk/fb-contrib/samples/UNNC_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-04-10 15:44:00 UTC (rev 1152) +++ trunk/fb-contrib/etc/findbugs.xml 2009-04-11 02:50:18 UTC (rev 1153) @@ -336,6 +336,10 @@ speed="moderate" reports="BED_BOGUS_EXCEPTION_DECLARATION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" + speed="fast" + reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -452,4 +456,5 @@ <BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" category="CORRECTNESS" /> <BugPattern abbrev="DSOC" type="DSOC_DUBIOUS_SET_OF_COLLECTIONS" category="PERFORMANCE" /> <BugPattern abbrev="BED" type="BED_BOGUS_EXCEPTION_DECLARATION" category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="UNNC" type="UNNC_UNNECESSARY_NEW_NULL_CHECK" category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-04-10 15:44:00 UTC (rev 1152) +++ trunk/fb-contrib/etc/messages.xml 2009-04-11 02:50:18 UTC (rev 1153) @@ -935,6 +935,18 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck"> + <Details> + <![CDATA[ + <p>looks for allocations of objects, and then immediately checking to see if the + object is null, or non null. As the new operator is guaranteed to eiher succeed, or throw + an exception, this null check is useless, and denotes a misunderstanding as to how + the jvm works. You can remove this guard.</p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -2444,6 +2456,18 @@ </Details> </BugPattern> + <BugPattern type="UNNC_UNNECESSARY_NEW_NULL_CHECK"> + <ShortDescription>method checks the result of a new allocation</ShortDescription> + <LongDescription>method {1} checks the result of a new allocation</LongDescription> + <Details> + <![CDATA[ + <p>This method allocations an object with new, and then checks that the object is null + or non null. As the new operator is guaranteed to either succeed or throw an exception, + this null check is unnecessary and can be removed. + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2522,4 +2546,5 @@ <BugCode abbrev="IICU">Incorrect Internal Class use</BugCode> <BugCode abbrev="DSOC">Dubious Set of Collections</BugCode> <BugCode abbrev="BED">Bogus Exception Declaration</BugCode> + <BugCode abbrev="UNNC">Unnecessary New Null Check</BugCode> </MessageCollection> \ No newline at end of file Added: trunk/fb-contrib/samples/UNNC_Sample.java =================================================================== --- trunk/fb-contrib/samples/UNNC_Sample.java (rev 0) +++ trunk/fb-contrib/samples/UNNC_Sample.java 2009-04-11 02:50:18 UTC (rev 1153) @@ -0,0 +1,55 @@ + + +public class UNNC_Sample { + public void testPosNEW() + { + UNNC_Sample sample = new UNNC_Sample(); + + if (sample != null) + System.out.println("OK"); + } + + public void testNegNEW() + { + UNNC_Sample sample = new UNNC_Sample(); + + if (sample == null) + return; + + System.out.println("OK"); + } + + public void testPosANEWARAY() + { + String[] s = new String[10]; + if (s != null) + System.out.println("OK"); + } + + public void testNegANEWARRAY() + { + String[] s = new String[10]; + if (s == null) + return; + + System.out.println("OK"); + } + + public void testPosMULTIANEWARRAY() + { + String[][] s = new String[10][5]; + if (s != null) + System.out.println("OK"); + } + + public void testNegMULTIANEWARRAY() + { + String[][] s = new String[10][5]; + if (s == null) + return; + + System.out.println("OK"); + } + + +} Property changes on: trunk/fb-contrib/samples/UNNC_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java 2009-04-11 02:50:18 UTC (rev 1153) @@ -0,0 +1,140 @@ +package com.mebigfatguy.fbcontrib.detect; + +import java.util.BitSet; +import java.util.HashSet; +import java.util.Set; + +import org.apache.bcel.Constants; +import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.CodeException; + +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.OpcodeStack; +import edu.umd.cs.findbugs.ba.ClassContext; + +/** looks for construction of new objects, and then the immediate testing + * whether the object is null or not. As the new operator will always succeed, + * or through an exception, this test is unnecessary and represents a misunderstanding + * as to how the jvm works. + */ +public class UnnecessaryNewNullCheck extends BytecodeScanningDetector +{ + private final BugReporter bugReporter; + private OpcodeStack stack; + private Set<Integer> allocationRegs; + private Set<Integer> handlerStarts; + + public UnnecessaryNewNullCheck(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + @Override + public void visitClassContext(ClassContext classContext) { + try { + stack = new OpcodeStack(); + allocationRegs = new HashSet<Integer>(); + handlerStarts = new HashSet<Integer>(); + super.visitClassContext(classContext); + } finally { + stack = null; + allocationRegs = null; + handlerStarts = null; + } + } + + @Override + public void visitCode(Code obj) { + if (prescreen()) { + stack.resetForMethodEntry(this); + allocationRegs.clear(); + handlerStarts.clear(); + + CodeException[] ce = obj.getExceptionTable(); + if (ce != null) { + for (CodeException element : ce) { + handlerStarts.add(Integer14.valueOf(element.getHandlerPC())); + } + } + super.visitCode(obj); + } + } + + @Override + public void sawOpcode(int seen) { + boolean sawAlloc = false; + try { + switch (seen) { + case NEW: + case ANEWARRAY: + case MULTIANEWARRAY: + sawAlloc = true; + break; + + case ASTORE: + case ASTORE_0: + case ASTORE_1: + case ASTORE_2: + case ASTORE_3: + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + int reg = RegisterUtils.getAStoreReg(this, seen); + if (item.getUserValue() != null) { + allocationRegs.add(Integer14.valueOf(reg)); + } else { + allocationRegs.remove(Integer14.valueOf(reg)); + } + } + break; + + case ALOAD: + case ALOAD_0: + case ALOAD_1: + case ALOAD_2: + case ALOAD_3: + int reg = RegisterUtils.getALoadReg(this, seen); + if (allocationRegs.contains(Integer14.valueOf(reg))) { + sawAlloc = true; + } + break; + + case IFNONNULL: + case IFNULL: + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + if (item.getUserValue() != null) { + bugReporter.reportBug(new BugInstance(this, "UNNC_UNNECESSARY_NEW_NULL_CHECK", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + break; + } + + if (handlerStarts.contains(Integer14.valueOf(getPC()))) + allocationRegs.clear(); + + } finally { + stack.sawOpcode(this, seen); + if (sawAlloc) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + item.setUserValue(Boolean.TRUE); + } + } + } + } + + private boolean prescreen() { + BitSet bytecodeSet = getClassContext().getBytecodeSet(getMethod()); + return (bytecodeSet != null) && + (bytecodeSet.get(Constants.NEW) + || bytecodeSet.get(Constants.ANEWARRAY) + || bytecodeSet.get(Constants.MULTIANEWARRAY)); + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-09 20:58:38
|
Revision: 1191 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1191&view=rev Author: dbrosius Date: 2009-05-09 20:58:29 +0000 (Sat, 09 May 2009) Log Message: ----------- add SMA Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/samples/UNNC_Sample.java Added Paths: ----------- trunk/fb-contrib/samples/SMA_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-05-09 20:21:13 UTC (rev 1190) +++ trunk/fb-contrib/etc/findbugs.xml 2009-05-09 20:58:29 UTC (rev 1191) @@ -344,6 +344,10 @@ speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" + speed="fast" + reports="SMA_STUTTERED_METHOD_ARGUMENTS" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -463,4 +467,5 @@ <BugPattern abbrev="BED" type="BED_BOGUS_EXCEPTION_DECLARATION" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="UNNC" type="UNNC_UNNECESSARY_NEW_NULL_CHECK" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="DTEP" type="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" category="STYLE" experimental="true" /> + <BugPattern abbrev="SMA" type="SMA_STUTTERED_METHOD_ARGUMENTS" category="STYLE" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-05-09 20:21:13 UTC (rev 1190) +++ trunk/fb-contrib/etc/messages.xml 2009-05-09 20:58:29 UTC (rev 1191) @@ -956,6 +956,17 @@ ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments"> + <Details> + <![CDATA[ + <p>looks for method calls that pass the same value for two separate parameters, where + those arguments are not constants. Often this is a cut/paste mistake, but if not, it is + confusing why you would pass the same value for two arguments.</p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> <!-- BugPattern --> @@ -2503,6 +2514,19 @@ </Details> </BugPattern> + <BugPattern type="SMA_STUTTERED_METHOD_ARGUMENTS"> + <ShortDescription>code calls a method passing the same value to two different arguments</ShortDescription> + <LongDescription>code {1} calls a method passing the same value to two different arguments</LongDescription> + <Details> + <![CDATA[ + <p>This method calls a method passing the same value for two or more of the parameters. + Often this is a cut/paste bug, but if not, it is confusing why you would pass the same value for two + different parameters. Perhaps an alternative method that just takes one parameter should be overridden + in this case.</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2583,4 +2607,5 @@ <BugCode abbrev="BED">Bogus Exception Declaration</BugCode> <BugCode abbrev="UNNC">Unnecessary New Null Check</BugCode> <BugCode abbrev="DTEP">Deprecated Typesafe Enum Pattern</BugCode> + <BugCode abbrev="SMA">Stuttered Method Arguments</BugCode> </MessageCollection> \ No newline at end of file Added: trunk/fb-contrib/samples/SMA_Sample.java =================================================================== --- trunk/fb-contrib/samples/SMA_Sample.java (rev 0) +++ trunk/fb-contrib/samples/SMA_Sample.java 2009-05-09 20:58:29 UTC (rev 1191) @@ -0,0 +1,14 @@ + +public class SMA_Sample +{ + public void testSMA(SMA_Sample s1, SMA_Sample s2) + { + if (!s1.equals(s2)) + testSMA(s1, s1); + } + + public void testNonReport(int a, int b) + { + testNonReport(4, 4); + } +} Property changes on: trunk/fb-contrib/samples/SMA_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/fb-contrib/samples/UNNC_Sample.java =================================================================== --- trunk/fb-contrib/samples/UNNC_Sample.java 2009-05-09 20:21:13 UTC (rev 1190) +++ trunk/fb-contrib/samples/UNNC_Sample.java 2009-05-09 20:58:29 UTC (rev 1191) @@ -1,5 +1,6 @@ + public class UNNC_Sample { public void testPosNEW() { @@ -51,5 +52,21 @@ System.out.println("OK"); } + public void testFPFinally() throws Exception + { + StringBuilder sb = null; + try + { + sb = new StringBuilder(); + sb.append("False Positive"); + } + finally + { + if (sb != null) + sb.setLength(0); + } + + } + } Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-05-09 20:58:29 UTC (rev 1191) @@ -0,0 +1,148 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2009 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.HashSet; +import java.util.Set; + +import org.apache.bcel.classfile.Code; + +import com.sun.org.apache.bcel.internal.generic.Type; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.BytecodeScanningDetector; +import edu.umd.cs.findbugs.OpcodeStack; +import edu.umd.cs.findbugs.ba.ClassContext; +import edu.umd.cs.findbugs.ba.XField; + +/** + * looks for method calls that passes the same argument to two different parameters of the same + * method. It doesn't report method calls where the arguments are constants. + */ +public class StutteredMethodArguments extends BytecodeScanningDetector { + private final BugReporter bugReporter; + private OpcodeStack stack; + + /** + * constructs a SMA detector given the reporter to report bugs on. + + * @param bugReporter the sync of bug reports + */ + public StutteredMethodArguments(BugReporter bugReporter) + { + this.bugReporter = bugReporter; + } + + /** + * overrides the visitor to create the opcode stack + * + * @param classContext the context object of the currently parsed class + */ + @Override + public void visitClassContext(ClassContext classContext) + { + try { + stack = new OpcodeStack(); + super.visitClassContext(classContext); + } finally { + stack = null; + } + } + + /** + * overrides the visitor to reset the stack object + * + * @param obj the context object of the currently parsed code block + */ + @Override + public void visitCode(Code obj) { + stack.resetForMethodEntry(this); + super.visitCode(obj); + } + + /** + * overrides the visitor to look for method calls that pass the same value + * for two different arguments + * + * @param seen the currently parsed op code + */ + @Override + public void sawOpcode(int seen) { + try { + switch (seen) { + case INVOKEVIRTUAL: + case INVOKESTATIC: + case INVOKEINTERFACE: + case INVOKESPECIAL: + 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)); + } + } + } + break; + } + } finally { + stack.sawOpcode(this, seen); + } + } + + /** + * looks for duplicate arguments that are not constants + * + * @param stack the stack to look thru + * @param length the number of arguments + * @return if there are duplicates + */ + private boolean duplicateArguments(OpcodeStack stack, int length) + { + Set<String> args = new HashSet<String>(); + for (int i = 0; i < length; i++) { + OpcodeStack.Item item = stack.getStackItem(i); + + if (item.getConstant() == null) { + String arg = null; + int reg = item.getRegisterNumber(); + if (reg >= 0) { + arg = String.valueOf(reg); + } else { + XField f = item.getXField(); + if (f != null) { + arg = f.getName(); + } + } + + if (arg != null) { + if (args.contains(arg)) + return true; + args.add(arg); + } + } + } + + return false; + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-05-09 20:59:26
|
Revision: 1192 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1192&view=rev Author: dbrosius Date: 2009-05-09 20:59:17 +0000 (Sat, 09 May 2009) Log Message: ----------- Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java Removed Paths: ------------- trunk/fb-contrib/samples/JVR_Sample.java Deleted: trunk/fb-contrib/samples/JVR_Sample.java =================================================================== --- trunk/fb-contrib/samples/JVR_Sample.java 2009-05-09 20:58:29 UTC (rev 1191) +++ trunk/fb-contrib/samples/JVR_Sample.java 2009-05-09 20:59:17 UTC (rev 1192) @@ -1,65 +0,0 @@ -import java.io.InputStream; -import java.io.OutputStream; -import java.sql.Blob; -import java.sql.ResultSet; -import java.sql.SQLException; - - - -public class JVR_Sample -{ - public String getBlobAsString(ResultSet rs) throws SQLException - { - VendorBlob vb = (VendorBlob)rs.getBlob(1); - return vb.convertBlobToString(); - } - - public String falsePositive(ResultSet rs) throws SQLException - { - Blob vb = rs.getBlob(1); - return vb.getClass().getName(); - } -} - -class VendorBlob implements Blob -{ - public String convertBlobToString() - { - return "Booya"; - } - - public InputStream getBinaryStream() throws SQLException { - return null; - } - - public byte[] getBytes(long arg0, int arg1) throws SQLException { - return null; - } - - public long length() throws SQLException { - return 0; - } - - public long position(Blob arg0, long arg1) throws SQLException { - return 0; - } - - public long position(byte[] arg0, long arg1) throws SQLException { - return 0; - } - - public OutputStream setBinaryStream(long arg0) throws SQLException { - return null; - } - - public int setBytes(long arg0, byte[] arg1, int arg2, int arg3) throws SQLException { - return 0; - } - - public int setBytes(long arg0, byte[] arg1) throws SQLException { - return 0; - } - - public void truncate(long arg0) throws SQLException { - } -} \ No newline at end of file Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java 2009-05-09 20:58:29 UTC (rev 1191) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java 2009-05-09 20:59:17 UTC (rev 1192) @@ -49,7 +49,7 @@ } private OpcodeStack stack; - private BugReporter bugReporter; + private final BugReporter bugReporter; private String[] methodInfo; private boolean indeterminate; private boolean seenNegative; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-07-15 04:48:53
|
Revision: 1219 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1219&view=rev Author: dbrosius Date: 2009-07-15 04:48:45 +0000 (Wed, 15 Jul 2009) Log Message: ----------- add SPP_USELESS_CASING Modified Paths: -------------- trunk/fb-contrib/etc/bugrank.txt trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2009-07-11 05:17:19 UTC (rev 1218) +++ trunk/fb-contrib/etc/bugrank.txt 2009-07-15 04:48:45 UTC (rev 1219) @@ -82,11 +82,12 @@ 0 BugPattern SPP_USELESS_TRINARY 0 BugPattern SPP_SUSPECT_STRING_TEST 0 BugPattern SPP_USE_STRINGBUILDER_LENGTH -0 BugPattern SPP_INVALID_CALENDAR_COMPARE" category="CORRECTNESS"/> -0 BugPattern SPP_USE_CONTAINSKEY" category="STYLE"/> -0 BugPattern SPP_USE_ISEMPTY" category="STYLE"/> -0 BugPattern SPP_USE_GETPROPERTY" category="STYLE"/> -0 BugPattern SPP_SERIALVER_SHOULD_BE_PRIVATE" category="STYLE"/> +0 BugPattern SPP_INVALID_CALENDAR_COMPARE +0 BugPattern SPP_USE_CONTAINSKEY +0 BugPattern SPP_USE_ISEMPTY +0 BugPattern SPP_USE_GETPROPERTY +0 BugPattern SPP_SERIALVER_SHOULD_BE_PRIVATE +0 BugPattern SPP_USELESS_CASING 0 BugPattern BAS_BLOATED_ASSIGNMENT_SCOPE 0 BugPattern SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR 0 BugPattern DWI_DELETING_WHILE_ITERATING Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-07-11 05:17:19 UTC (rev 1218) +++ trunk/fb-contrib/etc/findbugs.xml 2009-07-15 04:48:45 UTC (rev 1219) @@ -256,7 +256,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast" - reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY" /> + reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING" /> <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" @@ -442,6 +442,7 @@ <BugPattern abbrev="SPP" type="SPP_USE_CONTAINSKEY" category="STYLE"/> <BugPattern abbrev="SPP" type="SPP_USE_ISEMPTY" category="STYLE"/> <BugPattern abbrev="SPP" type="SPP_USE_GETPROPERTY" category="STYLE"/> + <BugPattern abbrev="SPP" type="SPP_USELESS_CASING" category="PERFORMANCE" experimental="true"/> <BugPattern abbrev="SPP" type="SPP_SERIALVER_SHOULD_BE_PRIVATE" category="STYLE"/> <BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" /> <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-07-11 05:17:19 UTC (rev 1218) +++ trunk/fb-contrib/etc/messages.xml 2009-07-15 04:48:45 UTC (rev 1219) @@ -2156,6 +2156,18 @@ </Details> </BugPattern> + <BugPattern type="SPP_USELESS_CASING"> + <ShortDescription>method compares string without case after enforcing a case</ShortDescription> + <LongDescription>method {1} compares string without case after enforcing a case</LongDescription> + <Details> + <![CDATA[ + This method compares two strings with compareToIgnoreCase or equalsIgnoreCase, after having + called toUpperCase or toLowerCase on the string in question. As you are comparing with out + concern to case, the toUpperCase or toLowerCase calls are pointless and can be removed. + ]]> + </Details> + </BugPattern> + <BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE"> <ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription> <LongDescription>Method {1} assigns a variable in a larger scope then is needed</LongDescription> Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2009-07-11 05:17:19 UTC (rev 1218) +++ trunk/fb-contrib/samples/SPP_Sample.java 2009-07-15 04:48:45 UTC (rev 1219) @@ -270,4 +270,15 @@ { String lf = System.getProperties().getProperty("line.separator"); } + + public boolean testCasing(String a, String b) + { + if (a.toUpperCase().equalsIgnoreCase(b)) + return true; + + if (a.toLowerCase().compareToIgnoreCase(b) == 0) + return true; + + return false; + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-07-11 05:17:19 UTC (rev 1218) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-07-15 04:48:45 UTC (rev 1219) @@ -421,6 +421,20 @@ } } else if ("toCharArray".equals(methodName)) { userValue = "toCharArray"; + } else if ("toLowerCase".equals(methodName) + || "toUpperCase".equals(methodName)) { + userValue = "IgnoreCase"; + } else if ("equalsIgnoreCase".equals(methodName) + || "compareToIgnoreCase".equals(methodName)) { + if (stack.getStackDepth() > 1) { + OpcodeStack.Item item = stack.getStackItem(1); + if ("IgnoreCase".equals(item.getUserValue())) { + bugReporter.reportBug(new BugInstance(this, "SPP_USELESS_CASING", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } } } else if ("equals(Ljava/lang/Object;)Z".equals(methodName + getSigConstantOperand())) { try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-07-17 03:12:23
|
Revision: 1220 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1220&view=rev Author: dbrosius Date: 2009-07-17 03:12:15 +0000 (Fri, 17 Jul 2009) Log Message: ----------- spilleng Modified Paths: -------------- trunk/fb-contrib/etc/bugrank.txt trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2009-07-15 04:48:45 UTC (rev 1219) +++ trunk/fb-contrib/etc/bugrank.txt 2009-07-17 03:12:15 UTC (rev 1220) @@ -105,7 +105,7 @@ 0 BugPattern JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT 0 BugPattern JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE 0 BugPattern JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT -0 BugPattern JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL +0 BugPattern JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL 0 BugPattern SCA_SUSPICIOUS_CLONE_ALGORITHM 0 BugPattern WEM_WEAK_EXCEPTION_MESSAGING 0 BugPattern SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-07-15 04:48:45 UTC (rev 1219) +++ trunk/fb-contrib/etc/findbugs.xml 2009-07-17 03:12:15 UTC (rev 1220) @@ -306,7 +306,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.JUnitAssertionOddities" speed="fast" - reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT,JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL" /> + reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT,JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousCloneAlgorithm" speed="fast" @@ -461,7 +461,7 @@ <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT" category="STYLE" /> <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE" category="STYLE" /> <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT" category="STYLE" /> - <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" /> + <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" /> <BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" category="CORRECTNESS" /> <BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" /> <BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-07-15 04:48:45 UTC (rev 1219) +++ trunk/fb-contrib/etc/messages.xml 2009-07-17 03:12:15 UTC (rev 1220) @@ -2392,7 +2392,7 @@ </Details> </BugPattern> - <BugPattern type="JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL"> + <BugPattern type="JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL"> <ShortDescription>method asserts that an auto-boxed value is not null</ShortDescription> <LongDescription>method {1} asserts that an auto-boxed value is not null</LongDescription> <Details> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2009-07-15 04:48:45 UTC (rev 1219) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2009-07-17 03:12:15 UTC (rev 1220) @@ -176,7 +176,7 @@ } else if ("assertNotNull".equals(methodName)) { if (stack.getStackDepth() > 0) { if ("valueOf".equals(stack.getStackItem(0).getUserValue())) { - bugReporter.reportBug(new BugInstance(this, "JAO_JUNIT_ASSERTION_ODITIES_IMPOSSIBLE_NULL", NORMAL_PRIORITY) + bugReporter.reportBug(new BugInstance(this, "JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL", 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...> - 2009-10-06 04:41:03
|
Revision: 1357 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1357&view=rev Author: dbrosius Date: 2009-10-06 04:40:55 +0000 (Tue, 06 Oct 2009) Log Message: ----------- hmmm, changes unknown Modified Paths: -------------- trunk/fb-contrib/samples/BED_Sample.java trunk/fb-contrib/samples/JAO_Sample.java trunk/fb-contrib/samples/OC_Sample.java trunk/fb-contrib/samples/samples.fb trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java Removed Paths: ------------- trunk/fb-contrib/samples/IPNC_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentParameterNameCasing.java Modified: trunk/fb-contrib/samples/BED_Sample.java =================================================================== --- trunk/fb-contrib/samples/BED_Sample.java 2009-10-06 04:39:43 UTC (rev 1356) +++ trunk/fb-contrib/samples/BED_Sample.java 2009-10-06 04:40:55 UTC (rev 1357) @@ -1,6 +1,8 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.File; +import java.io.IOException; import java.sql.SQLException; import java.util.Hashtable; import java.util.zip.DataFormatException; @@ -43,4 +45,17 @@ { InputStream is = new FileInputStream("c:\\temp.txt"); } + + public Object iAmCreatingAnObject() { + return new Object() { + private byte[] iHaveToThrowAnException() throws IOException { + return BED_Sample.this.iThrowAnException(); + } + }; + } + + private byte[] iThrowAnException() throws IOException { + File.createTempFile("foo", "bar"); + return "Test".getBytes("UTF-8"); + } } Deleted: trunk/fb-contrib/samples/IPNC_Sample.java =================================================================== --- trunk/fb-contrib/samples/IPNC_Sample.java 2009-10-06 04:39:43 UTC (rev 1356) +++ trunk/fb-contrib/samples/IPNC_Sample.java 2009-10-06 04:40:55 UTC (rev 1357) @@ -1,16 +0,0 @@ - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -public class IPNC_Sample -{ - public void doGet(HttpServletRequest req, HttpServletResponse resp) - { - String id = req.getParameter("id"); - } - - public void doPost(HttpServletRequest req, HttpServletResponse resp) - { - String id = req.getParameter("ID"); - } -} Modified: trunk/fb-contrib/samples/JAO_Sample.java =================================================================== --- trunk/fb-contrib/samples/JAO_Sample.java 2009-10-06 04:39:43 UTC (rev 1356) +++ trunk/fb-contrib/samples/JAO_Sample.java 2009-10-06 04:40:55 UTC (rev 1357) @@ -2,6 +2,7 @@ import junit.framework.TestCase; + public class JAO_Sample extends TestCase { @@ -30,4 +31,9 @@ Assert.assertNotNull(i); Assert.assertNotNull(i == 3); } + + public void test3ArgNP(float foo) + { + Assert.assertEquals(1.0f, foo, 0.1); + } } Modified: trunk/fb-contrib/samples/OC_Sample.java =================================================================== --- trunk/fb-contrib/samples/OC_Sample.java 2009-10-06 04:39:43 UTC (rev 1356) +++ trunk/fb-contrib/samples/OC_Sample.java 2009-10-06 04:40:55 UTC (rev 1357) @@ -3,8 +3,15 @@ public class OC_Sample { - public void castList(Object o) + private java.util.Date ud; + + public void castListInReg(Object o) { Collection<String> c = (ArrayList<String>)o; } + + public void castDateInField(Object o) + { + ud = (java.sql.Date)o; + } } \ No newline at end of file Modified: trunk/fb-contrib/samples/samples.fb =================================================================== --- trunk/fb-contrib/samples/samples.fb 2009-10-06 04:39:43 UTC (rev 1356) +++ trunk/fb-contrib/samples/samples.fb 2009-10-06 04:40:55 UTC (rev 1357) @@ -3,8 +3,8 @@ [Source dirs] . [Aux classpath entries] -.\lib\jsp-api.jar -.\lib\junit.jar -.\lib\servlet-api.jar +./lib/jsp-api.jar +./lib/junit.jar +./lib/servlet-api.jar [Options] relative_paths=true Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2009-10-06 04:39:43 UTC (rev 1356) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2009-10-06 04:40:55 UTC (rev 1357) @@ -37,6 +37,12 @@ import edu.umd.cs.findbugs.ba.ClassContext; import edu.umd.cs.findbugs.ba.XMethod; +/** + * looks for methods that rely on the format of the string fetched from another object's toString + * method, when that method appears not to be owned by the author of the calling method. + * As the implementation of toString() is often considered a private implementation detail of a class, + * and not something that should be relied on, depending on it's format is dangerous. + */ public class InappropriateToStringUse extends BytecodeScanningDetector { private static final Set<String> validToStringClasses = new HashSet<String>(); Deleted: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentParameterNameCasing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentParameterNameCasing.java 2009-10-06 04:39:43 UTC (rev 1356) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentParameterNameCasing.java 2009-10-06 04:40:55 UTC (rev 1357) @@ -1,140 +0,0 @@ -/* - * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 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.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -import org.apache.bcel.classfile.Code; - -import edu.umd.cs.findbugs.BugInstance; -import edu.umd.cs.findbugs.BugReporter; -import edu.umd.cs.findbugs.BytecodeScanningDetector; -import edu.umd.cs.findbugs.OpcodeStack; -import edu.umd.cs.findbugs.SourceLineAnnotation; -import edu.umd.cs.findbugs.ba.ClassContext; - -/** - * looks for calls to HttpRequest.getParameter with parameters of the same - * name with different cases like 'id' and 'Id'. - */ -public class InconsistentParameterNameCasing extends BytecodeScanningDetector -{ - private static final String HTTP_SERVLET_REQUEST = "javax/servlet/http/HttpServletRequest"; - private static final String GET_PARAMETER = "getParameter"; - private static final String GET_PARAMETER_SIG = "(Ljava/lang/String;)Ljava/lang/String;"; - BugReporter bugReporter; - OpcodeStack stack; - Map<String, Map<String, List<SourceInfo>>> parmInfo = new HashMap<String, Map<String, List<SourceInfo>>>(); - - public InconsistentParameterNameCasing(BugReporter reporter) { - bugReporter = reporter; - } - - public void visitClassContext(ClassContext classContext) { - try { - stack = new OpcodeStack(); - super.visitClassContext(classContext); - } finally { - stack = null; - } - } - - public void visitCode(Code obj) { - stack.resetForMethodEntry(this); - super.visitCode(obj); - } - - public void sawOpcode(int seen) { - try { - if (seen == INVOKEINTERFACE) { - String clsName = getClassConstantOperand(); - if (HTTP_SERVLET_REQUEST.equals(clsName)) { - String methodName = getNameConstantOperand(); - if (GET_PARAMETER.equals(methodName)) { - String signature = getSigConstantOperand(); - if (GET_PARAMETER_SIG.equals(signature)) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item item = stack.getStackItem(0); - String parmName = (String)item.getConstant(); - String upperParmName = parmName.toUpperCase(Locale.getDefault()); - Map<String, List<SourceInfo>> parmCaseInfo = parmInfo.get(upperParmName); - if (parmCaseInfo == null) { - parmCaseInfo = new HashMap<String, List<SourceInfo>>(); - parmInfo.put(upperParmName, parmCaseInfo); - } - - List<SourceInfo> annotations = parmCaseInfo.get(parmName); - if (annotations == null) { - annotations = new ArrayList<SourceInfo>(); - parmCaseInfo.put(parmName, annotations); - } - - annotations.add(new SourceInfo(getClassName(), getMethodName(), getMethodSig(), getMethod().isStatic(), SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, getPC()))); - } - } - } - } - } - } finally { - stack.sawOpcode(this, seen); - } - } - - @Override - public void report() { - for (Map<String, List<SourceInfo>> parmCaseInfo : parmInfo.values()) { - if (parmCaseInfo.size() > 1) { - BugInstance bi = new BugInstance(this, "IPNC_INCONSISTENT_HTTP_PARAM_CASING", NORMAL_PRIORITY); - - for (Map.Entry<String, List<SourceInfo>> sourceInfos :parmCaseInfo.entrySet()) { - for (SourceInfo sourceInfo : sourceInfos.getValue()) { - bi.addClass(sourceInfo.clsName); - bi.addMethod(sourceInfo.clsName, sourceInfo.methodName, sourceInfo.signature, sourceInfo.isStatic); - bi.addSourceLine(sourceInfo.srcLine); - bi.addString(sourceInfos.getKey()); - } - } - - bugReporter.reportBug(bi); - } - } - parmInfo.clear(); - } - - static class SourceInfo - { - String clsName; - String methodName; - String signature; - boolean isStatic; - SourceLineAnnotation srcLine; - - public SourceInfo(String cls, String method, String sig, boolean mStatic, SourceLineAnnotation annotation) { - clsName = cls; - methodName = method; - signature = sig; - isStatic = mStatic; - srcLine = annotation; - } - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-12 03:35:26
|
Revision: 1381 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1381&view=rev Author: dbrosius Date: 2009-11-12 03:35:19 +0000 (Thu, 12 Nov 2009) Log Message: ----------- latest updates for CVAA from bhaskar Modified Paths: -------------- trunk/fb-contrib/samples/CVAA_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java Modified: trunk/fb-contrib/samples/CVAA_Sample.java =================================================================== --- trunk/fb-contrib/samples/CVAA_Sample.java 2009-10-18 15:33:09 UTC (rev 1380) +++ trunk/fb-contrib/samples/CVAA_Sample.java 2009-11-12 03:35:19 UTC (rev 1381) @@ -2,25 +2,26 @@ public class CVAA_Sample { Base[] b2; - Derived[] d2; class Base {} class Derived extends Base {} public void cvaa() { - Derived[] d = new Derived[2]; - cvaa_invoke(d, 5); - Base[] b = d; - cvaa_invoke(b, 5); - b2 = d; - d2 = d; + Derived[] d2 = new Derived[4]; + Base[] b = d2; + b2 = d2; + Derived d = new Derived(); b[0] = new Base(); + b[1] = doDerived(); + b[2] = null; + b[3] = d; Integer[] a = new Integer[1]; System.arraycopy(a[0], 0, a, 1, 1); } - private void cvaa_invoke(Base[] b, int n){ + private Derived doDerived(){ + return new Derived(); } -} +} \ No newline at end of file Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2009-10-18 15:33:09 UTC (rev 1380) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2009-11-12 03:35:19 UTC (rev 1381) @@ -44,12 +44,14 @@ * A[] a = b; * a[0] = new A(); // results in ArrayStoreException (Runtime) * </pre> + * + * Contravariant array assignments are reported as low or normal priority bugs. In cases + * where the detector can determine an ArrayStoreException the bug is reported with high priority. * */ public class ContraVariantArrayAssignment extends BytecodeScanningDetector { private final BugReporter bugReporter; private final OpcodeStack stack; - private final boolean checkMethods; /** * constructs a CVAA detector given the reporter to report bugs on. @@ -59,7 +61,6 @@ public ContraVariantArrayAssignment(final BugReporter bugReporter) { this.bugReporter = bugReporter; stack = new OpcodeStack(); - checkMethods = System.getProperty("CCVA_CHECKMETHODS") != null; } /** @@ -88,7 +89,7 @@ case ASTORE_2: case ASTORE_3: if(stack.getStackDepth() > 0){ - OpcodeStack.Item item = stack.getStackItem(0); + OpcodeStack.Item item = stack.getStackItem(0); String sourceSignature = item.getSignature(); LocalVariable lv = getMethod().getLocalVariableTable() .getLocalVariable(RegisterUtils.getAStoreReg(this, seen), getNextPC()); @@ -107,17 +108,31 @@ checkSignatures(sourceSignature, targetSignature); } break; - case INVOKESTATIC: - case INVOKEVIRTUAL: - case INVOKEINTERFACE: - case INVOKESPECIAL: - if(checkMethods && stack.getStackDepth() > 0){ - String signature = getSigConstantOperand(); - checkMethodInvocation(signature); + case AASTORE: + OpcodeStack.Item arrayref = stack.getStackItem(2); + OpcodeStack.Item value = stack.getStackItem(0); + + if(!value.isNull()) { + String sourceSignature = value.getSignature(); + String targetSignature = arrayref.getSignature(); + try{ + if(Type.getType(sourceSignature) instanceof ObjectType ) { + ObjectType sourceType = (ObjectType) Type.getType(sourceSignature); + ObjectType targetType = (ObjectType) ((ArrayType) Type.getType(targetSignature)).getBasicType(); + if(!sourceType.subclassOf(targetType)){ + bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", HIGH_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); + } } - break; + break; } - super.sawOpcode(seen); + super.sawOpcode(seen); } finally{ stack.sawOpcode(this, seen); @@ -144,7 +159,7 @@ if(isObjectType(sourceSignature) && isObjectType(targetSignature)){ ObjectType sourceType = (ObjectType) ((ArrayType) Type.getType(sourceSignature)).getBasicType(); ObjectType targetType = (ObjectType) ((ArrayType) Type.getType(targetSignature)).getBasicType(); - if(sourceType.subclassOf(targetType) && !targetType.subclassOf(sourceType)) { + if(!targetType.subclassOf(sourceType)) { bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", NORMAL_PRIORITY) .addClass(this) .addMethod(this) @@ -152,20 +167,10 @@ } } } - } + } } catch(ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } - - private void checkMethodInvocation(String signature) { - Type[] types = Type.getArgumentTypes(signature); - for(int i = 0; i < types.length; i++){ - String targetSignature = types[i].getSignature(); - OpcodeStack.Item item = stack.getStackItem(types.length - i - 1); - String sourceSignature = item.getSignature(); - checkSignatures(sourceSignature, targetSignature); - } - } -} +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-12 05:13:51
|
Revision: 1382 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1382&view=rev Author: dbrosius Date: 2009-11-12 05:13:43 +0000 (Thu, 12 Nov 2009) Log Message: ----------- add NFF detector Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml Added Paths: ----------- trunk/fb-contrib/samples/NFF_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-11-12 03:35:19 UTC (rev 1381) +++ trunk/fb-contrib/etc/findbugs.xml 2009-11-12 05:13:43 UTC (rev 1382) @@ -381,6 +381,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" + speed="fast" + reports="NFF_NON_FUNCTIONAL_FIELD" /> <!-- BugPattern --> @@ -511,4 +515,5 @@ <BugPattern abbrev="PDP" type="PDP_POORLY_DEFINED_PARAMETER" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="NSE" type="NSE_NON_SYMMETRIC_EQUALS" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="CVAA" type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" category="CORRECTNESS" experimental="true"/> + <BugPattern abbrev="NFF" type="NFF_NON_FUNCTIONAL_FIELD" category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-11-12 03:35:19 UTC (rev 1381) +++ trunk/fb-contrib/etc/messages.xml 2009-11-12 05:13:43 UTC (rev 1382) @@ -1066,6 +1066,17 @@ ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField"> + <Details> + <![CDATA[ + <p>looks for fields in serializable classes that are defined as both final and + transient. As a transient field is not initialized when streamed, and is not + initialized in a constructor, it will remain null because it is defined final.</p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> <!-- BugPattern --> @@ -2730,7 +2741,7 @@ <LongDescription>method {1} performs a contravariant array assignment</LongDescription> <Details> <![CDATA[ - <p>Finds contravariant array assignments. Since arrays are mutable data structures, their use + <p>this method contains a contravariant array assignment. Since arrays are mutable data structures, their use must be restricted to covariant or invariant usage</p> <pre> @@ -2746,6 +2757,19 @@ </Details> </BugPattern> + <BugPattern type="NFF_NON_FUNCTIONAL_FIELD"> + <ShortDescription>serializable class defines a final transient field</ShortDescription> + <LongDescription>serializable class {0} defines a final transient field</LongDescription> + <Details> + <![CDATA[ + <p>this serializable class defines a field as both transient and final. As transient fields + are not serialized across the stream, it is required that some piece of code reinitialize that field + when it is deserialized. But since constructors aren't called when deserialization, the field is not initialized. + And since the field is final, no other method can initialize it as well.</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2835,4 +2859,5 @@ <BugCode abbrev="PDP">Poorly Defined Parameter</BugCode> <BugCode abbrev="NSE">Non Symmetric Equals</BugCode> <BugCode abbrev="CVAA">Contravariant Array Assignment</BugCode> + <BugCode abbrev="NFF">Non Functional Field</BugCode> </MessageCollection> \ No newline at end of file Added: trunk/fb-contrib/samples/NFF_Sample.java =================================================================== --- trunk/fb-contrib/samples/NFF_Sample.java (rev 0) +++ trunk/fb-contrib/samples/NFF_Sample.java 2009-11-12 05:13:43 UTC (rev 1382) @@ -0,0 +1,8 @@ +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +public class NFF_Sample implements Serializable +{ + private final transient List<String> s = new ArrayList<String>(); +} \ No newline at end of file Property changes on: trunk/fb-contrib/samples/NFF_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2009-11-12 05:13:43 UTC (rev 1382) @@ -0,0 +1,86 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2009 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 org.apache.bcel.Repository; +import org.apache.bcel.classfile.Field; +import org.apache.bcel.classfile.JavaClass; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.Detector; +import edu.umd.cs.findbugs.Priorities; +import edu.umd.cs.findbugs.ba.ClassContext; +import edu.umd.cs.findbugs.visitclass.PreorderVisitor; + +/** + * looks for fields in serializable classes that are defined as both final and + * transient. As a transient field is not initialized when streamed, and is not + * initialized in a constructor, it will remain null because it is defined final. + */ +public class NonFunctionalField extends PreorderVisitor implements Detector { + + private static JavaClass serializableClass; + + static { + try { + serializableClass = Repository.lookupClass("java/io/Serializable"); + } catch (ClassNotFoundException cnfe) { + serializableClass = null; + } + } + + private BugReporter bugReporter; + /** + * constructs a NFF detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ + public NonFunctionalField(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + /** + * checks to see if the class is Serializable, then looks for fields + * that are both final and transient + * @param classContext the context object of the currently parsed class + */ + + @Override + public void visitClassContext(ClassContext classContext) { + try { + JavaClass cls = classContext.getJavaClass(); + if ((serializableClass != null) && (cls.implementationOf(serializableClass))) { + Field[] fields = cls.getFields(); + for (Field f : fields) { + if (f.isFinal() && f.isTransient()) { + bugReporter.reportBug(new BugInstance(this, "NFF_NON_FUNCTIONAL_FIELD", Priorities.NORMAL_PRIORITY) + .addClass(this) + .addField(cls.getClassName(), f.getName(), f.getSignature(), f.getAccessFlags())); + } + } + } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); + } + } + + @Override + public void report() { + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-12-19 18:05:43
|
Revision: 1391 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1391&view=rev Author: dbrosius Date: 2009-12-19 18:05:32 +0000 (Sat, 19 Dec 2009) Log Message: ----------- new detector (Wrong Null Guard) Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml Added Paths: ----------- trunk/fb-contrib/.settings/ trunk/fb-contrib/samples/WNG_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-11-26 03:25:08 UTC (rev 1390) +++ trunk/fb-contrib/etc/findbugs.xml 2009-12-19 18:05:32 UTC (rev 1391) @@ -1,519 +1,569 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- - Plugin descriptor for fb-contrib plugin. - This plugin is enabled by default. ---> + <!-- + Plugin descriptor for fb-contrib plugin. This plugin is enabled by + default. + --> <FindbugsPlugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="findbugsplugin.xsd" - pluginid="com.mebigfatguy.fbcontrib" - defaultenabled="true" - provider="fb-contrib project" - website="http://fb-contrib.sourceforge.net"> - - <!-- Passes --> - - <OrderingConstraints> - <SplitPass> - <Earlier class="com.mebigfatguy.fbcontrib.collect.CollectStatistics"/> - <LaterCategory name="reporting" spanplugins="true"/> - </SplitPass> - </OrderingConstraints> - - <!-- Detectors --> - - <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" - speed="fast" - reports="" - hidden="true" /> - - - <Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering" - speed="fast" - reports="ISB_INEFFICIENT_STRING_BUFFERING,ISB_EMPTY_STRING_APPENDING" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators" - speed="slow" - reports="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.CyclomaticComplexity" - speed="slow" - reports="CC_CYCLOMATIC_COMPLEXITY" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.OverlyConcreteParameter" - speed="slow" - reports="OCP_OVERLY_CONCRETE_PARAMETER" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ListIndexedIterating" - speed="moderate" - reports="LII_LIST_INDEXED_ITERATING" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" - speed="fast" - reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" - speed="fast" - reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" - speed="fast" - reports="CE_CLASS_ENVY" - disabled="true" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" - speed="fast" - reports="LSC_LITERAL_STRING_COMPARISON" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" - speed="fast" - reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousListCollection" - speed="fast" - reports="DLC_DUBIOUS_LIST_COLLECTION" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ParallelLists" - speed="fast" - reports="PL_PARALLEL_LISTS" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.FinalParameters" - speed="slow" - reports="FP_FINAL_PARAMETERS" /> + xsi:noNamespaceSchemaLocation="findbugsplugin.xsd" pluginid="com.mebigfatguy.fbcontrib" + defaultenabled="true" provider="fb-contrib project" website="http://fb-contrib.sourceforge.net"> - <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractClassEmptyMethods" - speed="fast" - reports="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" /> + <!-- Passes --> - <Detector class="com.mebigfatguy.fbcontrib.detect.ManualArrayCopy" - speed="fast" - reports="MAC_MANUAL_ARRAY_COPY" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.FloatingPointLoops" - speed="fast" - reports="FPL_FLOATING_POINT_LOOPS" /> + <OrderingConstraints> + <SplitPass> + <Earlier class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" /> + <LaterCategory name="reporting" spanplugins="true" /> + </SplitPass> + </OrderingConstraints> - <Detector class="com.mebigfatguy.fbcontrib.detect.NonCollectionMethodUse" - speed="fast" - reports="NCMU_NON_COLLECTION_METHOD_USE" /> + <!-- Detectors --> - <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingAutoboxedOverloading" - speed="fast" - reports="CAO_CONFUSING_AUTOBOXED_OVERLOADING" /> + <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" + speed="fast" reports="" hidden="true" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.AbnormalFinallyBlockReturn" - speed="fast" - reports="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.StaticMethodInstanceInvocation" - speed="fast" - reports="SMII_STATIC_METHOD_INSTANCE_INVOCATION" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SpuriousThreadStates" - speed="fast" - reports="STS_SPURIOUS_THREAD_STATES" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessAutoboxing" - speed="fast" - reports="NAB_NEEDLESS_AUTOBOXING_CTOR,NAB_NEEDLESS_BOXING_STRING_CTOR,NAB_NEEDLESS_AUTOBOXING_VALUEOF,NAB_NEEDLESS_BOXING_PARSE,NAB_NEEDLESS_BOXING_VALUEOF,NAB_NEEDLESS_BOX_TO_UNBOX,NAB_NEEDLESS_BOX_TO_CAST,NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering" + speed="fast" reports="ISB_INEFFICIENT_STRING_BUFFERING,ISB_EMPTY_STRING_APPENDING" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn" - speed="fast" - reports="USBR_UNNECESSARY_STORE_BEFORE_RETURN" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod" - speed="fast" - reports="COM_COPIED_OVERRIDDEN_METHOD" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayBasedCollections" - speed="fast" - reports="ABC_ARRAY_BASED_COLLECTIONS" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.OrphanedDOMNode" - speed="fast" - reports="ODN_ORPHANED_DOM_NODE" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" - speed="fast" - reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" - speed="fast" - reports="CBX_CUSTOM_BUILT_XML" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" - speed="fast" - reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" - hidden="true" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" - speed="fast" - reports="CLI_CONSTANT_LIST_INDEX" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators" + speed="slow" reports="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" - speed="fast" - reports="SCR_SLOPPY_CLASS_REFLECTION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.CyclomaticComplexity" + speed="slow" reports="CC_CYCLOMATIC_COMPLEXITY" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayWrappedCallByReference" - speed="fast" - reports="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.OverlyConcreteParameter" + speed="slow" reports="OCP_OVERLY_CONCRETE_PARAMETER" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.SluggishGui" - speed="fast" - reports="SG_SLUGGISH_GUI" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessInstanceRetrieval" - speed="fast" - reports="NIR_NEEDLESS_INSTANCE_RETRIEVAL" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.DateComparison" - speed="fast" - reports="DDC_DOUBLE_DATE_COMPARISON" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousWaitOnConcurrentObject" - speed="fast" - reports="SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT" /> - + <Detector class="com.mebigfatguy.fbcontrib.detect.ListIndexedIterating" + speed="moderate" reports="LII_LIST_INDEXED_ITERATING" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" + speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" + speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" + speed="fast" reports="CE_CLASS_ENVY" disabled="true" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" + speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" + speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousListCollection" + speed="fast" reports="DLC_DUBIOUS_LIST_COLLECTION" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ParallelLists" + speed="fast" reports="PL_PARALLEL_LISTS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.FinalParameters" + speed="slow" reports="FP_FINAL_PARAMETERS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractClassEmptyMethods" + speed="fast" reports="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ManualArrayCopy" + speed="fast" reports="MAC_MANUAL_ARRAY_COPY" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.FloatingPointLoops" + speed="fast" reports="FPL_FLOATING_POINT_LOOPS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NonCollectionMethodUse" + speed="fast" reports="NCMU_NON_COLLECTION_METHOD_USE" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.ConfusingAutoboxedOverloading" + speed="fast" reports="CAO_CONFUSING_AUTOBOXED_OVERLOADING" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.AbnormalFinallyBlockReturn" + speed="fast" reports="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.StaticMethodInstanceInvocation" + speed="fast" reports="SMII_STATIC_METHOD_INSTANCE_INVOCATION" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.SpuriousThreadStates" + speed="fast" reports="STS_SPURIOUS_THREAD_STATES" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessAutoboxing" + speed="fast" + reports="NAB_NEEDLESS_AUTOBOXING_CTOR,NAB_NEEDLESS_BOXING_STRING_CTOR,NAB_NEEDLESS_AUTOBOXING_VALUEOF,NAB_NEEDLESS_BOXING_PARSE,NAB_NEEDLESS_BOXING_VALUEOF,NAB_NEEDLESS_BOX_TO_UNBOX,NAB_NEEDLESS_BOX_TO_CAST,NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn" + speed="fast" reports="USBR_UNNECESSARY_STORE_BEFORE_RETURN" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod" + speed="fast" reports="COM_COPIED_OVERRIDDEN_METHOD" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayBasedCollections" + speed="fast" reports="ABC_ARRAY_BASED_COLLECTIONS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.OrphanedDOMNode" + speed="fast" reports="ODN_ORPHANED_DOM_NODE" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" + speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" + speed="fast" reports="CBX_CUSTOM_BUILT_XML" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" + speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" + speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" + speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.ArrayWrappedCallByReference" + speed="fast" reports="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.SluggishGui" + speed="fast" reports="SG_SLUGGISH_GUI" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessInstanceRetrieval" + speed="fast" reports="NIR_NEEDLESS_INSTANCE_RETRIEVAL" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.DateComparison" + speed="fast" reports="DDC_DOUBLE_DATE_COMPARISON" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SuspiciousWaitOnConcurrentObject" + speed="fast" reports="SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.JDBCVendorReliance" - speed="fast" - reports="JVR_JDBC_VENDOR_RELIANCE" /> - + speed="fast" reports="JVR_JDBC_VENDOR_RELIANCE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.PossibleMemoryBloat" - speed="fast" - reports="PMB_POSSIBLE_MEMORY_BLOAT" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.LocalSynchronizedCollection" - speed="moderate" - reports="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" /> - + speed="fast" reports="PMB_POSSIBLE_MEMORY_BLOAT" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.LocalSynchronizedCollection" + speed="moderate" reports="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.FieldCouldBeLocal" - speed="slow" - reports="FCBL_FIELD_COULD_BE_LOCAL" /> - + speed="slow" reports="FCBL_FIELD_COULD_BE_LOCAL" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.NonOwnedSynchronization" - speed="fast" - reports="NOS_NON_OWNED_SYNCHRONIZATION" /> - + speed="fast" reports="NOS_NON_OWNED_SYNCHRONIZATION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.NonRecycleableTaglibs" - speed="fast" - reports="NRTL_NON_RECYCLEABLE_TAG_LIBS" /> - + speed="fast" reports="NRTL_NON_RECYCLEABLE_TAG_LIBS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.Section508Compliance" - speed="fast" - reports="S508C_NULL_LAYOUT,S508C_NO_SETLABELFOR,S508C_NO_SETSIZE,S508C_NON_ACCESSIBLE_JCOMPONENT,S508C_SET_COMP_COLOR" /> - + speed="fast" + reports="S508C_NULL_LAYOUT,S508C_NO_SETLABELFOR,S508C_NO_SETSIZE,S508C_NON_ACCESSIBLE_JCOMPONENT,S508C_SET_COMP_COLOR" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UseEnumCollections" - speed="fast" - reports="UEC_USE_ENUM_COLLECTIONS" /> - + speed="fast" reports="UEC_USE_ENUM_COLLECTIONS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SQLInLoop" - speed="fast" - reports="SIL_SQL_IN_LOOP" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessMemberCollectionSynchronization" - speed="moderate" - reports="NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION" /> - + speed="fast" reports="SIL_SQL_IN_LOOP" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.NeedlessMemberCollectionSynchronization" + speed="moderate" reports="NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.InheritanceTypeChecking" - speed="moderate" - reports="ITC_INHERITANCE_TYPE_CHECKING" /> - + speed="moderate" reports="ITC_INHERITANCE_TYPE_CHECKING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.StaticArrayCreatedInMethod" - speed="fast" - reports="SACM_STATIC_ARRAY_CREATED_IN_METHOD" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.PossiblyRedundantMethodCalls" - speed="fast" - reports="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" /> - + speed="fast" reports="SACM_STATIC_ARRAY_CREATED_IN_METHOD" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.PossiblyRedundantMethodCalls" + speed="fast" reports="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UseToArray" - speed="fast" - reports="UTA_USE_TO_ARRAY" /> - + speed="fast" reports="UTA_USE_TO_ARRAY" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.LostExceptionStackTrace" - speed="moderate" - reports="LEST_LOST_EXCEPTION_STACK_TRACE" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.UseCharacterParameterizedMethod" - speed="fast" - reports="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" /> - + speed="moderate" reports="LEST_LOST_EXCEPTION_STACK_TRACE" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.UseCharacterParameterizedMethod" + speed="fast" reports="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.TailRecursion" - speed="fast" - reports="TR_TAIL_RECURSION" /> - + speed="fast" reports="TR_TAIL_RECURSION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedReturnValues" - speed="fast" - reports="URV_UNRELATED_RETURN_VALUES,URV_CHANGE_RETURN_TYPE,URV_INHERITED_METHOD_WITH_RELATED_TYPES" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.PossibleIncompleteSerialization" - speed="fast" - reports="PIS_POSSIBLE_INCOMPLETE_SERIALIZATION" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" - speed="fast" - reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" /> - + speed="fast" + reports="URV_UNRELATED_RETURN_VALUES,URV_CHANGE_RETURN_TYPE,URV_INHERITED_METHOD_WITH_RELATED_TYPES" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.PossibleIncompleteSerialization" + speed="fast" reports="PIS_POSSIBLE_INCOMPLETE_SERIALIZATION" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" + speed="fast" reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" - speed="fast" - reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING" /> - + speed="fast" + reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" - speed="fast" - reports="BAS_BLOATED_ASSIGNMENT_SCOPE" - hidden="true" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" - speed="fast" - reports="SCI_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" /> - + speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" + speed="fast" reports="SCI_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.DeletingWhileIterating" - speed="fast" - reports="DWI_DELETING_WHILE_ITERATING,DWI_MODIFYING_WHILE_ITERATING" /> - + speed="fast" reports="DWI_DELETING_WHILE_ITERATING,DWI_MODIFYING_WHILE_ITERATING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UseSplit" - speed="fast" - reports="USS_USE_STRING_SPLIT" /> - + speed="fast" reports="USS_USE_STRING_SPLIT" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousJDKVersionUse" - speed="slow" - reports="SJVU_SUSPICIOUS_JDK_VERSION_USE" - disabled="true" /> - + speed="slow" reports="SJVU_SUSPICIOUS_JDK_VERSION_USE" disabled="true" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UseAddAll" - speed="fast" - reports="UAA_USE_ADD_ALL" /> - + speed="fast" reports="UAA_USE_ADD_ALL" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.MethodReturnsConstant" - speed="fast" - reports="MRC_METHOD_RETURNS_CONSTANT" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessCustomSerialization" - speed="fast" - reports="NCS_NEEDLESS_CUSTOM_SERIALIZATION" /> - + speed="fast" reports="MRC_METHOD_RETURNS_CONSTANT" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.NeedlessCustomSerialization" + speed="fast" reports="NCS_NEEDLESS_CUSTOM_SERIALIZATION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.MisleadingOverloadModel" - speed="fast" - reports="MOM_MISLEADING_OVERLOAD_MODEL" /> - + speed="fast" reports="MOM_MISLEADING_OVERLOAD_MODEL" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ExceptionSoftening" - speed="moderate" - reports="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS,EXS_EXCEPTION_SOFTENING_HAS_CHECKED,EXS_EXCEPTION_SOFTENING_NO_CHECKED" /> - + speed="moderate" + reports="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS,EXS_EXCEPTION_SOFTENING_HAS_CHECKED,EXS_EXCEPTION_SOFTENING_NO_CHECKED" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingFunctionSemantics" - speed="fast" - reports="CFS_CONFUSING_FUNCTION_SEMANTICS" /> - + speed="fast" reports="CFS_CONFUSING_FUNCTION_SEMANTICS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.JUnitAssertionOddities" - speed="fast" - reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT,JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" /> - + speed="fast" + reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT,JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousCloneAlgorithm" - speed="fast" - reports="SCA_SUSPICIOUS_CLONE_ALGORITHM" /> - + speed="fast" reports="SCA_SUSPICIOUS_CLONE_ALGORITHM" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.WeakExceptionMessaging" - speed="fast" - reports="WEM_WEAK_EXCEPTION_MESSAGING" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousClusteredSessionSupport" - speed="fast" - reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" /> - + speed="fast" reports="WEM_WEAK_EXCEPTION_MESSAGING" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SuspiciousClusteredSessionSupport" + speed="fast" reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" - speed="fast" - reports="LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER" /> - + speed="fast" reports="LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" - speed="fast" - reports="IICU_INCORRECT_INTERNAL_CLASS_USE" /> - + speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousSetOfCollections" - speed="moderate" - reports="DSOC_DUBIOUS_SET_OF_COLLECTIONS" /> - + speed="moderate" reports="DSOC_DUBIOUS_SET_OF_COLLECTIONS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.BogusExceptionDeclaration" - speed="moderate" - reports="BED_BOGUS_EXCEPTION_DECLARATION" /> - + speed="moderate" reports="BED_BOGUS_EXCEPTION_DECLARATION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" - speed="fast" - reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" - speed="fast" - reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> - + speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" + speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" - speed="fast" - reports="SMA_STUTTERED_METHOD_ARGUMENTS" - hidden="true" /> - + speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" - speed="fast" - reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> - - - <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousUninitializedArray" - speed="fast" - reports="SUA_SUSPICIOUS_UNINITIALIZED_ARRAY" /> - + speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> + + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SuspiciousUninitializedArray" + speed="fast" reports="SUA_SUSPICIOUS_UNINITIALIZED_ARRAY" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.InappropriateToStringUse" - speed="fast" - reports="ITU_INAPPROPRIATE_TOSTRING_USE" /> - + speed="fast" reports="ITU_INAPPROPRIATE_TOSTRING_USE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.InconsistentKeyNameCasing" - speed="fast" - reports="IKNC_INCONSISTENT_HTTP_PARAM_CASING" /> - + speed="fast" reports="IKNC_INCONSISTENT_HTTP_PARAM_CASING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.OverzealousCasting" - speed="fast" - reports="OC_OVERZEALOUS_CASTING" /> - + speed="fast" reports="OC_OVERZEALOUS_CASTING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" - speed="fast" - reports="PDP_POORLY_DEFINED_PARAMETER" /> - + speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" - speed="fast" - reports="NSE_NON_SYMMETRIC_EQUALS" /> + speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" - speed="fast" - reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" - speed="fast" - reports="NFF_NON_FUNCTIONAL_FIELD" /> - - <!-- BugPattern --> - - <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> - <BugPattern abbrev="ISB" type="ISB_EMPTY_STRING_APPENDING" category="PERFORMANCE" /> - <BugPattern abbrev="SCI" type="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" category="CORRECTNESS" /> - <BugPattern abbrev="CC" type="CC_CYCLOMATIC_COMPLEXITY" category="STYLE" /> - <BugPattern abbrev="OCP" type="OCP_OVERLY_CONCRETE_PARAMETER" category="STYLE" /> - <BugPattern abbrev="LII" type="LII_LIST_INDEXED_ITERATING" category="STYLE" /> - <BugPattern abbrev="UCC" type="UCC_UNRELATED_COLLECTION_CONTENTS" category="STYLE" /> - <BugPattern abbrev="DRE" type="DRE_DECLARED_RUNTIME_EXCEPTION" category="STYLE" /> - <BugPattern abbrev="CE" type="CE_CLASS_ENVY" category="STYLE" experimental="true" /> - <BugPattern abbrev="LSC" type="LSC_LITERAL_STRING_COMPARISON" category="STYLE" /> - <BugPattern abbrev="PCOA" type="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" category="CORRECTNESS" /> - <BugPattern abbrev="DLC" type="DLC_DUBIOUS_LIST_COLLECTION" category="PERFORMANCE" /> - <BugPattern abbrev="PL" type="PL_PARALLEL_LISTS" category="STYLE" /> - <BugPattern abbrev="FP" type="FP_FINAL_PARAMETERS" category="STYLE" /> - <BugPattern abbrev="ACEM" type="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" category="STYLE" /> - <BugPattern abbrev="MAC" type="MAC_MANUAL_ARRAY_COPY" category="PERFORMANCE" /> - <BugPattern abbrev="FPL" type="FPL_FLOATING_POINT_LOOPS" category="CORRECTNESS" /> - <BugPattern abbrev="NCMU" type="NCMU_NON_COLLECTION_METHOD_USE" category="STYLE" /> - <BugPattern abbrev="CAO" type="CAO_CONFUSING_AUTOBOXED_OVERLOADING" category="CORRECTNESS" /> - <BugPattern abbrev="AFBR" type="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" category="CORRECTNESS" /> - <BugPattern abbrev="SMII" type="SMII_STATIC_METHOD_INSTANCE_INVOCATION" category="STYLE" /> - <BugPattern abbrev="STS" type="STS_SPURIOUS_THREAD_STATES" category="MT_CORRECTNESS" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING_CTOR" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_STRING_CTOR" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING_VALUEOF" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_PARSE" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_VALUEOF" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_UNBOX" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_CAST" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" category="PERFORMANCE" /> - <BugPattern abbrev="USBR" type="USBR_UNNECESSARY_STORE_BEFORE_RETURN" category="STYLE" /> - <BugPattern abbrev="COM" type="COM_COPIED_OVERRIDDEN_METHOD" category="STYLE" /> - <BugPattern abbrev="ABC" type="ABC_ARRAY_BASED_COLLECTIONS" category="CORRECTNESS" /> - <BugPattern abbrev="ODN" type="ODN_ORPHANED_DOM_NODE" category="CORRECTNESS" /> - <BugPattern abbrev="AOM" type="AOM_ABSTRACT_OVERRIDDEN_METHOD" category="CORRECTNESS" /> - <BugPattern abbrev="CBX" type="CBX_CUSTOM_BUILT_XML" category="STYLE" /> - <BugPattern abbrev="BSB" type="BSB_BLOATED_SYNCHRONIZED_BLOCK" category="PERFORMANCE" experimental="true" /> - <BugPattern abbrev="CLI" type="CLI_CONSTANT_LIST_INDEX" category="CORRECTNESS" /> - <BugPattern abbrev="SCR" type="SCR_SLOPPY_CLASS_REFLECTION" category="STYLE" /> - <BugPattern abbrev="AWCBR" type="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" category="STYLE" /> + <Detector + class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" + speed="fast" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" + speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.WrongNullGuard" + speed="fast" reports="WNG_WRONG_NULL_FIELD_GUARD,WNG_WRONG_NULL_LOCAL_GUARD" /> + + <!-- BugPattern --> + + <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" + category="PERFORMANCE" /> + <BugPattern abbrev="ISB" type="ISB_EMPTY_STRING_APPENDING" + category="PERFORMANCE" /> + <BugPattern abbrev="SCI" type="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" + category="CORRECTNESS" /> + <BugPattern abbrev="CC" type="CC_CYCLOMATIC_COMPLEXITY" + category="STYLE" /> + <BugPattern abbrev="OCP" type="OCP_OVERLY_CONCRETE_PARAMETER" + category="STYLE" /> + <BugPattern abbrev="LII" type="LII_LIST_INDEXED_ITERATING" + category="STYLE" /> + <BugPattern abbrev="UCC" type="UCC_UNRELATED_COLLECTION_CONTENTS" + category="STYLE" /> + <BugPattern abbrev="DRE" type="DRE_DECLARED_RUNTIME_EXCEPTION" + category="STYLE" /> + <BugPattern abbrev="CE" type="CE_CLASS_ENVY" category="STYLE" + experimental="true" /> + <BugPattern abbrev="LSC" type="LSC_LITERAL_STRING_COMPARISON" + category="STYLE" /> + <BugPattern abbrev="PCOA" + type="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" category="CORRECTNESS" /> + <BugPattern abbrev="DLC" type="DLC_DUBIOUS_LIST_COLLECTION" + category="PERFORMANCE" /> + <BugPattern abbrev="PL" type="PL_PARALLEL_LISTS" category="STYLE" /> + <BugPattern abbrev="FP" type="FP_FINAL_PARAMETERS" category="STYLE" /> + <BugPattern abbrev="ACEM" type="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" + category="STYLE" /> + <BugPattern abbrev="MAC" type="MAC_MANUAL_ARRAY_COPY" + category="PERFORMANCE" /> + <BugPattern abbrev="FPL" type="FPL_FLOATING_POINT_LOOPS" + category="CORRECTNESS" /> + <BugPattern abbrev="NCMU" type="NCMU_NON_COLLECTION_METHOD_USE" + category="STYLE" /> + <BugPattern abbrev="CAO" type="CAO_CONFUSING_AUTOBOXED_OVERLOADING" + category="CORRECTNESS" /> + <BugPattern abbrev="AFBR" type="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" + category="CORRECTNESS" /> + <BugPattern abbrev="SMII" type="SMII_STATIC_METHOD_INSTANCE_INVOCATION" + category="STYLE" /> + <BugPattern abbrev="STS" type="STS_SPURIOUS_THREAD_STATES" + category="MT_CORRECTNESS" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING_CTOR" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_STRING_CTOR" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING_VALUEOF" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_PARSE" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_VALUEOF" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_UNBOX" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_CAST" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" + type="NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" category="PERFORMANCE" /> + <BugPattern abbrev="USBR" type="USBR_UNNECESSARY_STORE_BEFORE_RETURN" + category="STYLE" /> + <BugPattern abbrev="COM" type="COM_COPIED_OVERRIDDEN_METHOD" + category="STYLE" /> + <BugPattern abbrev="ABC" type="ABC_ARRAY_BASED_COLLECTIONS" + category="CORRECTNESS" /> + <BugPattern abbrev="ODN" type="ODN_ORPHANED_DOM_NODE" + category="CORRECTNESS" /> + <BugPattern abbrev="AOM" type="AOM_ABSTRACT_OVERRIDDEN_METHOD" + category="CORRECTNESS" /> + <BugPattern abbrev="CBX" type="CBX_CUSTOM_BUILT_XML" + category="STYLE" /> + <BugPattern abbrev="BSB" type="BSB_BLOATED_SYNCHRONIZED_BLOCK" + category="PERFORMANCE" experimental="true" /> + <BugPattern abbrev="CLI" type="CLI_CONSTANT_LIST_INDEX" + category="CORRECTNESS" /> + <BugPattern abbrev="SCR" type="SCR_SLOPPY_CLASS_REFLECTION" + category="STYLE" /> + <BugPattern abbrev="AWCBR" type="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" + category="STYLE" /> <BugPattern abbrev="SG" type="SG_SLUGGISH_GUI" category="PERFORMANCE" /> - <BugPattern abbrev="NIR" type="NIR_NEEDLESS_INSTANCE_RETRIEVAL" category="PERFORMANCE" /> - <BugPattern abbrev="DDC" type="DDC_DOUBLE_DATE_COMPARISON" category="PERFORMANCE" /> - <BugPattern abbrev="SWCO" type="SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT" category="CORRECTNESS" /> - <BugPattern abbrev="JVR" type="JVR_JDBC_VENDOR_RELIANCE" category="CORRECTNESS" /> - <BugPattern abbrev="PMB" type="PMB_POSSIBLE_MEMORY_BLOAT" category="CORRECTNESS" /> - <BugPattern abbrev="LSYC" type="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" category="CORRECTNESS" /> - <BugPattern abbrev="FCBL" type="FCBL_FIELD_COULD_BE_LOCAL" category="CORRECTNESS" /> - <BugPattern abbrev="NOS" type="NOS_NON_OWNED_SYNCHRONIZATION" category="STYLE" /> - <BugPattern abbrev="NRTL" type="NRTL_NON_RECYCLEABLE_TAG_LIB" category="CORRECTNESS" /> - <BugPattern abbrev="S508C" type="S508C_NULL_LAYOUT" category="CORRECTNESS" /> - <BugPattern abbrev="S508C" type="S508C_NO_SETLABELFOR" category="CORRECTNESS" /> + <BugPattern abbrev="NIR" type="NIR_NEEDLESS_INSTANCE_RETRIEVAL" + category="PERFORMANCE" /> + <BugPattern abbrev="DDC" type="DDC_DOUBLE_DATE_COMPARISON" + category="PERFORMANCE" /> + <BugPattern abbrev="SWCO" + type="SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT" category="CORRECTNESS" /> + <BugPattern abbrev="JVR" type="JVR_JDBC_VENDOR_RELIANCE" + category="CORRECTNESS" /> + <BugPattern abbrev="PMB" type="PMB_POSSIBLE_MEMORY_BLOAT" + category="CORRECTNESS" /> + <BugPattern abbrev="LSYC" type="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" + category="CORRECTNESS" /> + <BugPattern abbrev="FCBL" type="FCBL_FIELD_COULD_BE_LOCAL" + category="CORRECTNESS" /> + <BugPattern abbrev="NOS" type="NOS_NON_OWNED_SYNCHRONIZATION" + category="STYLE" /> + <BugPattern abbrev="NRTL" type="NRTL_NON_RECYCLEABLE_TAG_LIB" + category="CORRECTNESS" /> + <BugPattern abbrev="S508C" type="S508C_NULL_LAYOUT" + category="CORRECTNESS" /> + <BugPattern abbrev="S508C" type="S508C_NO_SETLABELFOR" + category="CORRECTNESS" /> <BugPattern abbrev="S508C" type="S508C_NO_SETSIZE" category="CORRECTNESS" /> - <BugPattern abbrev="S508C" type="S508C_NON_ACCESSIBLE_JCOMPONENT" category="CORRECTNESS" /> - <BugPattern abbrev="S508C" type="S508C_SET_COMP_COLOR" category="CORRECTNESS" /> - <BugPattern abbrev="UEC" type="UEC_USE_ENUM_COLLECTIONS" category="PERFORMANCE" /> + <BugPattern abbrev="S508C" type="S508C_NON_ACCESSIBLE_JCOMPONENT" + category="CORRECTNESS" /> + <BugPattern abbrev="S508C" type="S508C_SET_COMP_COLOR" + category="CORRECTNESS" /> + <BugPattern abbrev="UEC" type="UEC_USE_ENUM_COLLECTIONS" + category="PERFORMANCE" /> <BugPattern abbrev="SIL" type="SIL_SQL_IN_LOOP" category="PERFORMANCE" /> - <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="PRMC" type="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" category="PERFORMANCE" /> + <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="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" /> - <BugPattern abbrev="UCPM" type="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" category="PERFORMANCE" /> + <BugPattern abbrev="LEST" type="LEST_LOST_EXCEPTION_STACK_TRACE" + category="CORRECTNESS" /> + <BugPattern abbrev="UCPM" type="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" + category="PERFORMANCE" /> <BugPattern abbrev="TR" type="TR_TAIL_RECURSION" category="PERFORMANCE" /> - <BugPattern abbrev="URV" type="URV_UNRELATED_RETURN_VALUES" category="STYLE" /> - <BugPattern abbrev="URV" type="URV_CHANGE_RETURN_TYPE" category="STYLE" /> - <BugPattern abbrev="URV" type="URV_INHERITED_METHOD_WITH_RELATED_TYPES" category="STYLE" /> - <BugPattern abbrev="PIS" type="PIS_POSSIBLE_INCOMPLETE_SERIALIZATION" category="CORRECTNESS" /> - <BugPattern abbrev="SCRV" type="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_NEGATIVE_BITSET_ITEM" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_INTERN_ON_CONSTANT" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_NO_CHAR_SB_CTOR" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_USE_MATH_CONSTANT" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_STUTTERED_ASSIGNMENT" category="CORRECTNESS" /> + <BugPattern abbrev="URV" type="URV_UNRELATED_RETURN_VALUES" + category="STYLE" /> + <BugPattern abbrev="URV" type="URV_CHANGE_RETURN_TYPE" + category="STYLE" /> + <BugPattern abbrev="URV" type="URV_INHERITED_METHOD_WITH_RELATED_TYPES" + category="STYLE" /> + <BugPattern abbrev="PIS" type="PIS_POSSIBLE_INCOMPLETE_SERIALIZATION" + category="CORRECTNESS" /> + <BugPattern abbrev="SCRV" type="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_NEGATIVE_BITSET_ITEM" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_INTERN_ON_CONSTANT" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_NO_CHAR_SB_CTOR" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_USE_MATH_CONSTANT" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_STUTTERED_ASSIGNMENT" + category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_USE_ISNAN" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_USE_BIGDECIMAL_STRING_CTOR" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_STRINGBUFFER_WITH_EMPTY_STRING" category="PERFORMANCE" /> + <BugPattern abbrev="SPP" type="SPP_USE_BIGDECIMAL_STRING_CTOR" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_STRINGBUFFER_WITH_EMPTY_STRING" + category="PERFORMANCE" /> <BugPattern abbrev="SPP" type="SPP_EQUALS_ON_ENUM" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_INVALID_BOOLEAN_NULL_CHECK" category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_INVALID_BOOLEAN_NULL_CHECK" + category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_USE_CHARAT" category="PERFORMANCE" /> - <BugPattern abbrev="SPP" type="SPP_USELESS_TRINARY" category="PERFORMANCE" /> - <BugPattern abbrev="SPP" type="SPP_SUSPECT_STRING_TEST" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_USE_STRINGBUILDER_LENGTH" category="PERFORMANCE" /> - <BugPattern abbrev="SPP" type="SPP_INVALID_CALENDAR_COMPARE" category="CORRECTNESS"/> - <BugPattern abbrev="SPP" type="SPP_USE_CONTAINSKEY" category="STYLE"/> - <BugPattern abbrev="SPP" type="SPP_USE_ISEMPTY" category="STYLE"/> - <BugPattern abbrev="SPP" type="SPP_USE_GETPROPERTY" category="STYLE"/> - <BugPattern abbrev="SPP" type="SPP_USELESS_CASING" category="PERFORMANCE" experimental="true"/> - <BugPattern abbrev="SPP" type="SPP_SERIALVER_SHOULD_BE_PRIVATE" category="STYLE"/> - <BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" /> - <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" /> - <BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" /> - <BugPattern abbrev="DWI" type="DWI_MODIFYING_WHILE_ITERATING" category="CORRECTNESS" /> - <BugPattern abbrev="USS" type="USS_USE_STRING_SPLIT" category="STYLE" /> - <BugPattern abbrev="SJVU" type="SJVU_SUSPICIOUS_JDK_VERSION_USE" category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_USELESS_TRINARY" + category="PERFORMANCE" /> + <BugPattern abbrev="SPP" type="SPP_SUSPECT_STRING_TEST" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_USE_STRINGBUILDER_LENGTH" + category="PERFORMANCE" /> + <BugPattern abbrev="SPP" type="SPP_INVALID_CALENDAR_COMPARE" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_USE_CONTAINSKEY" + category="STYLE" /> + <BugPattern abbrev="SPP" type="SPP_USE_ISEMPTY" category="STYLE" /> + <BugPattern abbrev="SPP" type="SPP_USE_GETPROPERTY" + category="STYLE" /> + <BugPattern abbrev="SPP" type="SPP_USELESS_CASING" category="PERFORMANCE" + experimental="true" /> + <BugPattern abbrev="SPP" type="SPP_SERIALVER_SHOULD_BE_PRIVATE" + category="STYLE" /> + <BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" + category="PERFORMANCE" /> + <BugPattern abbrev="SCII" + type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" /> + <BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" + category="CORRECTNESS" /> + <BugPattern abbrev="DWI" type="DWI_MODIFYING_WHILE_ITERATING" + category="CORRECTNESS" /> + <BugPattern abbrev="USS" type="USS_USE_STRING_SPLIT" + category="STYLE" /> + <BugPattern abbrev="SJVU" type="SJVU_SUSPICIOUS_JDK_VERSION_USE" + category="CORRECTNESS" /> <BugPattern abbrev="UAA" type="UAA_USE_ADD_ALL" category="STYLE" /> - <BugPattern abbrev="MRC" type="MRC_METHOD_RETURNS_CONSTANT" category="STYLE" /> - <BugPattern abbrev="NCS" type="NCS_NEEDLESS_CUSTOM_SERIALIZATION" category="CORRECTNESS" /> - <BugPattern abbrev="MOM" type="MOM_MISLEADING_OVERLOAD_MODEL" category="STYLE" /> - <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS" category="STYLE" /> - <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_HAS_CHECKED" category="STYLE" /> - <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CHECKED" category="STYLE" /> - <BugPattern abbrev="CFS" type="CFS_CONFUSING_FUNCTION_SEMANTICS" category="STYLE" /> - <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT" category="STYLE" /> - <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE" category="STYLE" /> - <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT" category="STYLE" /> - <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" /> - <BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" category="CORRECTNESS" /> - <BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" /> - <BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" /> - <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" category="CORRECTNESS" /> - <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_PARAMETER" category="CORRECTNESS" /> - <BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" category="CORRECTNESS" /> - <BugPattern abbrev="DSOC" type="DSOC_DUBIOUS_SET_OF_COLLECTIONS" category="PERFORMANCE" /> - <BugPattern abbrev="BED" type="BED_BOGUS_EXCEPTION_DECLARATION" category="CORRECTNESS" /> - <BugPattern abbrev="UNNC" type="UNNC_UNNECESSARY_NEW_NULL_CHECK" category="CORRECTNESS" /> - <BugPattern abbrev="DTEP" type="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" category="STYLE" /> - <BugPattern abbrev="SMA" type="SMA_STUTTERED_METHOD_ARGUMENTS" category="STYLE" /> - <BugPattern abbrev="TBP" type="TBP_TRISTATE_BOOLEAN_PATTERN" category="STYLE" /> - <BugPattern abbrev="SUA" type="SUA_SUSPICIOUS_UNINITIALIZED_ARRAY" category="CORRECTNESS" /> - <BugPattern abbrev="ITU" type="ITU_INAPPROPRIATE_TOSTRING_USE" category="CORRECTNESS" /> - <BugPattern abbrev="IKNC" type="IKNC_INCONSISTENT_HTTP_PARAM_CASING" category="STYLE" experimental="true" /> - <BugPattern abbrev="OC" type="OC_OVERZEALOUS_CASTING" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="PDP" type="PDP_POORLY_DEFINED_PARAMETER" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="NSE" type="NSE_NON_SYMMETRIC_EQUALS" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="CVAA" type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="NFF" type="NFF_NON_FUNCTIONAL_FIELD" category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="MRC" type="MRC_METHOD_RETURNS_CONSTANT" + category="STYLE" /> + <BugPattern abbrev="NCS" type="NCS_NEEDLESS_CUSTOM_SERIALIZATION" + category="CORRECTNESS" /> + <BugPattern abbrev="MOM" type="MOM_MISLEADING_OVERLOAD_MODEL" + category="STYLE" /> + <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS" + category="STYLE" /> + <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_HAS_CHECKED" + category="STYLE" /> + <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CHECKED" + category="STYLE" /> + <BugPattern abbrev="CFS" type="CFS_CONFUSING_FUNCTION_SEMANTICS" + category="STYLE" /> + <BugPattern abbrev="JAO" + type="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT" category="STYLE" /> + <BugPattern abbrev="JAO" + type="JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE" category="STYLE" /> + <BugPattern abbrev="JAO" + type="JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT" category="STYLE" /> + <BugPattern abbrev="JAO" + type="JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" /> + <BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" + category="CORRECTNESS" /> + <BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" + category="STYLE" /> + <BugPattern abbrev="SCSS" + type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" /> + <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" + category="CORRECTNESS" /> + <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_PARAMETER" + category="CORRECTNESS" /> + <BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" + category="CORRECTNESS" /> + <BugPattern abbrev="DSOC" type="DSOC_DUBIOUS_SET_OF_COLLECTIONS" + category="PERFORMANCE" /> + <BugPattern abbrev="BED" type="BED_BOGUS_EXCEPTION_DECLARATION" + category="CORRECTNESS" /> + <BugPattern abbrev="UNNC" type="UNNC_UNNECESSARY_NEW_NULL_CHECK" + category="CORRECTNESS" /> + <BugPattern abbrev="DTEP" type="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" + category="STYLE" /> + <BugPattern abbrev="SMA" type="SMA_STUTTERED_METHOD_ARGUMENTS" + category="STYLE" /> + <BugPattern abbrev="TBP" type="TBP_TRISTATE_BOOLEAN_PATTERN" + category="STYLE" /> + <BugPattern abbrev="SUA" type="SUA_SUSPICIOUS_UNINITIALIZED_ARRAY" + category="CORRECTNESS" /> + <BugPattern abbrev="ITU" type="ITU_INAPPROPRIATE_TOSTRING_USE" + category="CORRECTNESS" /> + <BugPattern abbrev="IKNC" type="IKNC_INCONSISTENT_HTTP_PARAM_CASING" + category="STYLE" experimental="true" /> + <BugPattern abbrev="OC" type="OC_OVERZEALOUS_CASTING" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="PDP" type="PDP_POORLY_DEFINED_PARAMETER" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="NSE" type="NSE_NON_SYMMETRIC_EQUALS" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="CVAA" type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="NFF" type="NFF_NON_FUNCTIONAL_FIELD" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="WNG" type="WNG_WRONG_NULL_FIELD_GUARD" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="WNG" type="WNG_WRONG_NULL_LOCAL_GUARD" + category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-11-26 03:25:08 UTC (rev 1390) +++ trunk/fb-contrib/etc/messages.xml 2009-12-19 18:05:32 UTC (rev 1391) @@ -1048,35 +1048,48 @@ </Details> </Detector> - <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment"> - <Details> - <![CDATA[ - <p>Finds contravariant array assignments. Since arrays are mutable data structures, their use - must be restricted to covariant or invariant usage</p> - - <pre> - class A {} - class B extends A {} - - B[] b = new B[2]; - A[] a = b; - a[0] = new A(); // results in ArrayStoreException (Runtime) - </pre> - <p>It is a fast detector</p> - ]]> - </Details> - </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment"> + <Details> + <![CDATA[ + <p>Finds contravariant array assignments. Since arrays are mutable data structures, their use + must be restricted to covariant or invariant usage</p> + + <pre> + class A {} + class B extends A {} + + B[] b = new B[2]; + A[] a = b; + a[0] = new A(); // results in ArrayStoreException (Runtime) + </pre> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> - <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField"> - <Details> - <![CDATA[ - <p>looks for fields in serializable classes that are defined as both final and + <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField"> + <Details> + <![CDATA[ + <p>looks for fields in serializable classes that are defined as both final and transient. As a transient field is not initialized when streamed, and is not initialized in a constructor, it will remain null because it is defined final.</p> <p>It is a fast detector</p> ]]> - </Details> - </Detector> + </Details> + </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.WrongNullGuard"> + <Details> + <![CDATA[ + <p>looks for code that checks to see if a field or local variable is not null, + before entering a code block either an if, or while statement, and then doesn't + reference that field or local in the block of code that is guarded by the null + check. It is likely that null check is being done on the wrong variable, either + because of a copy/paste error, or a change in implementation.</p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> <!-- BugPattern --> @@ -2736,40 +2749,65 @@ </Details> </BugPattern> - <BugPattern type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT"> - <ShortDescription>method performs a contravariant array assignment</ShortDescription> - <LongDescription>method {1} performs a contravariant array assignment</LongDescription> - <Details> - <![CDATA[ - <p>this method contains a contravariant array assignment. Since arrays are mutable data structures, their use - must be restricted to covariant or invariant usage</p> - - <pre> - class A {} - class B extends A {} - - B[] b = new B[2]; - A[] a = b; - a[0] = new A(); // results in ArrayStoreException (Runtime) - </pre> - <p>It is a fast detector</p> - ]]> - </Details> - </BugPattern> + <BugPattern type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT"> + <ShortDescription>method performs a contravariant array assignment</ShortDescription> + <LongDescription>method {1} performs a contravariant array assignment</LongDescription> + <Details> + <![CDATA[ + <p>This method contains a contravariant array assignment. Since arrays are mutable data structures, their use + must be restricted to covariant or invariant usage</p> + + <pre> + class A {} + class B extends A {} + + B[] b = new B[2]; + A[] a = b; + a[0] = new A(); // results in ArrayStoreException (Runtime) + </pre> + <p>It is a fast detector</p> + ]]> + </Details> + </BugPattern> - <BugPattern type="NFF_NON_FUNCTIONAL_FIELD"> - <ShortDescription>serializable class defines a final transient field</ShortDescription> - <LongDescription>serializable class {0} defines a final transient field</LongDescription> - <Details> - <![CDATA[ - <p>this serializable class defines a field as both transient and final. As transient fields - are not serialized across the stream, it is required that some piece of code reinitialize that field - when it is deserialized. But since constructors aren't called when deserialization, the field is not initialized. - And since the field is final, no other method can initialize it as well.</p> - ]]> - </Details> - </BugPattern> + <BugPattern type="NFF_NON_FUNCTIONAL_FIELD"> + <ShortDescription>serializable class defines a final transient field</ShortDescription> + <LongDescription>serializable class {0} defines a final transient field</LongDescription> + <Details> + <![CDATA[ + <p>This serializable class defines a field as both transient and final. As transient fields + are not serialized across the stream, it is required that some piece of code reinitialize that field + when it is deserialized. But since constructors aren't called when deserialization, the field is not initialized. + And since the field is final, no other method can initialize it as well.</p> + ]]> + </Details> + </BugPattern> + <BugPattern type="WNG_WRONG_NULL_FIELD_GUARD"> + <ShortDescription>method tests a field for null as guard for code that doesn't use it</ShortDescription> + <LongDescription>method {1} tests a field for null as guard for code that doesn't use it</LongDescription> + <Details> + <![CDATA[ + <p>This method tests a field to make sure it's not null before executing a conditional block of + code. However, it does not appear that this block of code relies on the field in question, so the + choice of null guard seems dubious. It is possible that the code block calls a method that requires + this field not to be null, but that would seem like an odd construct.</p> + ]]> + </Details> + </BugPattern> + + <BugPattern type="WNG_WRONG_NULL_LOCAL_GUARD"> + <ShortDescription>method tests a local variable for null as guard for code that doesn't use it</ShortDescription> + <LongDescription>method {1} tests a local variable for null as guard for code that doesn't use it</LongDescription> + <Details> + <![CDATA[ + <p>This method tests a local variable to make sure it's not null before executing a conditional block of + code. However, this block of does not access the local variable in question, so the + choice of null guard seems wrong. Perhaps this is a copy/paste mistake.</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2858,6 +2896,7 @@ <BugCode abbrev="OC">Overzealous Casting</BugCode> <BugCode abbrev="PDP">Poorly Defined Parameter</BugCode> <BugCode abbrev="NSE">Non Symmetric Equals</BugCode> - <BugCode abbrev="CVAA">Contravariant Array Assignment</BugCode> - <BugCode abbrev="NFF">Non Functional Field</BugCode> + <BugCode abbrev="CVAA">Contravariant Array Assignment</BugCode> + <BugCode abbrev="NFF">Non Functional Field</BugCode> + <BugCode abbrev="WNG">Wrong Null Guard</BugCode> </MessageCollection> \ No newline at end of file Added: trunk/fb-contrib/samples/WNG_Sample.java =================================================================== --- trunk/fb-contrib/samples/WNG_Sample.java (rev 0) +++ trunk/fb-contrib/samples/WNG_Sample.java 2009-12-19 18:05:32 UTC (rev 1391) @@ -0,0 +1,22 @@ + +public class WNG_Sample +{ + private Object f1 = null; + private Object f2 = null; + + public String badWNGFields() + { + if (f1 != null) + return f2.toString(); + + return null; + } + + public String badWNGLocals(Object l1, Object l2) + { + if (l1 != null) + return l2.toString(); + + return null; + } +} Property changes on: trunk/fb-contrib/samples/WNG_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-19 18:05:32 UTC (rev 1391) @@ -0,0 +1,183 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2009 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.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.bcel.classfile.Code; + +import com.mebigfatguy.fbcontrib.utils.Integer14; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.BytecodeScanningDetector; +import edu.umd.cs.findbugs.OpcodeStack; +import edu.umd.cs.findbugs.ba.ClassContext; +import edu.umd.cs.findbugs.ba.XField; + +/** + * looks for code that checks to see if a field or local variable is not null, + * before entering a code block ... [truncated message content] |
From: <dbr...@us...> - 2009-12-19 23:45:12
|
Revision: 1397 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1397&view=rev Author: dbrosius Date: 2009-12-19 23:45:00 +0000 (Sat, 19 Dec 2009) Log Message: ----------- add support for IKNC for HttpSession.getAttribute/setAttribute Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java Added Paths: ----------- trunk/fb-contrib/javadoc/ Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-12-19 23:35:21 UTC (rev 1396) +++ trunk/fb-contrib/etc/findbugs.xml 2009-12-19 23:45:00 UTC (rev 1397) @@ -295,7 +295,7 @@ speed="fast" reports="ITU_INAPPROPRIATE_TOSTRING_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.InconsistentKeyNameCasing" - speed="fast" reports="IKNC_INCONSISTENT_HTTP_PARAM_CASING" /> + speed="fast" reports="IKNC_INCONSISTENT_HTTP_ATTRIBUTE_CASING,IKNC_INCONSISTENT_HTTP_PARAM_CASING" /> <Detector class="com.mebigfatguy.fbcontrib.detect.OverzealousCasting" speed="fast" reports="OC_OVERZEALOUS_CASTING" /> @@ -550,6 +550,8 @@ category="CORRECTNESS" /> <BugPattern abbrev="ITU" type="ITU_INAPPROPRIATE_TOSTRING_USE" category="CORRECTNESS" /> + <BugPattern abbrev="IKNC" type="IKNC_INCONSISTENT_HTTP_ATTRIBUTE_CASING" + category="STYLE" experimental="true" /> <BugPattern abbrev="IKNC" type="IKNC_INCONSISTENT_HTTP_PARAM_CASING" category="STYLE" experimental="true" /> <BugPattern abbrev="OC" type="OC_OVERZEALOUS_CASTING" Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-12-19 23:35:21 UTC (rev 1396) +++ trunk/fb-contrib/etc/messages.xml 2009-12-19 23:45:00 UTC (rev 1397) @@ -1006,8 +1006,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.InconsistentKeyNameCasing"> <Details> <![CDATA[ - <p>looks for methods that use the same name with different casing to access objects in HttpRequest Parameters. - As these parameter names are case sensitive this will lead to confusion.</p> + <p>looks for methods that use the same name with different casing to access objects in HttpRequest parameters + and attributes. As these parameter names are case sensitive this will lead to confusion.</p> <p>It is a fast detector</p> ]]> </Details> @@ -2700,6 +2700,17 @@ </Details> </BugPattern> + <BugPattern type="IKNC_INCONSISTENT_HTTP_ATTRIBUTE_CASING"> + <ShortDescription>method uses the same HttpSession attribute name but with different casing</ShortDescription> + <LongDescription>method {1} uses the same HttpSession attribute name but with different casing</LongDescription> + <Details> + <![CDATA[ + <p>This method sets or gets an HttpSession attribute with a parmeter name that was used in other locations + but with a different casing. As HttpSession attribute are case sensitive, this will be very confusing. + ]]> + </Details> + </BugPattern> + <BugPattern type="IKNC_INCONSISTENT_HTTP_PARAM_CASING"> <ShortDescription>method uses the same HttpRequestRequest parameter name but with different casing</ShortDescription> <LongDescription>method {1} uses the same HttpRequestRequest parameter name but with different casing</LongDescription> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2009-12-19 23:35:21 UTC (rev 1396) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2009-12-19 23:45:00 UTC (rev 1397) @@ -19,6 +19,7 @@ package com.mebigfatguy.fbcontrib.detect; import java.util.ArrayList; +import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -26,6 +27,8 @@ import org.apache.bcel.classfile.Code; +import com.sun.org.apache.bcel.internal.generic.Type; + import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; @@ -38,13 +41,34 @@ * name with different cases like 'id' and 'Id'. */ public class InconsistentKeyNameCasing extends BytecodeScanningDetector -{ +{ + private static final String HTTP_SESSION = "javax/servlet/http/HttpSession"; private static final String HTTP_SERVLET_REQUEST = "javax/servlet/http/HttpServletRequest"; + private static final String GET_ATTRIBUTE = "getAttribute"; + private static final String SET_ATTRIBUTE = "setAttribute"; private static final String GET_PARAMETER = "getParameter"; + private static final String GET_ATTRIBUTE_SIG = "(Ljava/lang/String;)Ljava/lang/Object;"; + private static final String SET_ATTRIBUTE_SIG = "(Ljava/lang/String;Ljava/lang/Object;)V"; private static final String GET_PARAMETER_SIG = "(Ljava/lang/String;)Ljava/lang/String;"; + + enum KeyType { + ATTRIBUTE("IKNC_INCONSISTENT_HTTP_ATTRIBUTE_CASING"), + PARAMETER("IKNC_INCONSISTENT_HTTP_PARAM_CASING"); + + private String key; + + KeyType(String descriptionKey) { + key = descriptionKey; + } + + public String getDescription() { + return key; + } + }; + BugReporter bugReporter; OpcodeStack stack; - Map<String, Map<String, List<SourceInfo>>> parmInfo = new HashMap<String, Map<String, List<SourceInfo>>>(); + Map<KeyType, Map<String, Map<String, List<SourceInfo>>>> parmInfo; /** * constructs a IKNC detector given the reporter to report bugs on @@ -52,6 +76,9 @@ */ public InconsistentKeyNameCasing(BugReporter reporter) { bugReporter = reporter; + parmInfo = new EnumMap<KeyType, Map<String, Map<String, List<SourceInfo>>>>(KeyType.class); + parmInfo.put(KeyType.ATTRIBUTE, new HashMap<String, Map<String, List<SourceInfo>>>()); + parmInfo.put(KeyType.PARAMETER, new HashMap<String, Map<String, List<SourceInfo>>>()); } /** @@ -87,36 +114,32 @@ public void sawOpcode(int seen) { try { if (seen == INVOKEINTERFACE) { - String clsName = getClassConstantOperand(); - if (HTTP_SERVLET_REQUEST.equals(clsName)) { - String methodName = getNameConstantOperand(); - if (GET_PARAMETER.equals(methodName)) { - String signature = getSigConstantOperand(); - if (GET_PARAMETER_SIG.equals(signature)) { - if (stack.getStackDepth() > 0) { - OpcodeStack.Item item = stack.getStackItem(0); - String parmName = (String)item.getConstant(); - if (parmName != null) - { - String upperParmName = parmName.toUpperCase(Locale.getDefault()); - Map<String, List<SourceInfo>> parmCaseInfo = parmInfo.get(upperParmName); - if (parmCaseInfo == null) { - parmCaseInfo = new HashMap<String, List<SourceInfo>>(); - parmInfo.put(upperParmName, parmCaseInfo); - } - - List<SourceInfo> annotations = parmCaseInfo.get(parmName); - if (annotations == null) { - annotations = new ArrayList<SourceInfo>(); - parmCaseInfo.put(parmName, annotations); - } - - annotations.add(new SourceInfo(getClassName(), getMethodName(), getMethodSig(), getMethod().isStatic(), SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, getPC()))); - } + KeyType type = isKeyAccessMethod(seen); + if (type != null) { + int numParms = Type.getArgumentTypes(getSigConstantOperand()).length; + if (stack.getStackDepth() >= numParms) { + OpcodeStack.Item item = stack.getStackItem(numParms - 1); + String parmName = (String)item.getConstant(); + if (parmName != null) + { + String upperParmName = parmName.toUpperCase(Locale.getDefault()); + Map<String, Map<String, List<SourceInfo>>> typeMap = parmInfo.get(KeyType.PARAMETER); + Map<String, List<SourceInfo>> parmCaseInfo = typeMap.get(upperParmName); + if (parmCaseInfo == null) { + parmCaseInfo = new HashMap<String, List<SourceInfo>>(); + typeMap.put(upperParmName, parmCaseInfo); } + + List<SourceInfo> annotations = parmCaseInfo.get(parmName); + if (annotations == null) { + annotations = new ArrayList<SourceInfo>(); + parmCaseInfo.put(parmName, annotations); + } + + annotations.add(new SourceInfo(getClassName(), getMethodName(), getMethodSig(), getMethod().isStatic(), SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, getPC()))); } } - } + } } } finally { stack.sawOpcode(this, seen); @@ -129,25 +152,53 @@ */ @Override public void report() { - for (Map<String, List<SourceInfo>> parmCaseInfo : parmInfo.values()) { - if (parmCaseInfo.size() > 1) { - BugInstance bi = new BugInstance(this, "IKNC_INCONSISTENT_HTTP_PARAM_CASING", NORMAL_PRIORITY); - - for (Map.Entry<String, List<SourceInfo>> sourceInfos :parmCaseInfo.entrySet()) { - for (SourceInfo sourceInfo : sourceInfos.getValue()) { - bi.addClass(sourceInfo.clsName); - bi.addMethod(sourceInfo.clsName, sourceInfo.methodName, sourceInfo.signature, sourceInfo.isStatic); - bi.addSourceLine(sourceInfo.srcLine); - bi.addString(sourceInfos.getKey()); - } - } - - bugReporter.reportBug(bi); - } - } + for (Map.Entry<KeyType, Map<String, Map<String, List<SourceInfo>>>> entry : parmInfo.entrySet()) { + KeyType type = entry.getKey(); + Map<String, Map<String, List<SourceInfo>>> typeMap = entry.getValue(); + + for (Map<String, List<SourceInfo>> parmCaseInfo : typeMap.values()) { + if (parmCaseInfo.size() > 1) { + BugInstance bi = new BugInstance(this, type.getDescription(), NORMAL_PRIORITY); + + for (Map.Entry<String, List<SourceInfo>> sourceInfos :parmCaseInfo.entrySet()) { + for (SourceInfo sourceInfo : sourceInfos.getValue()) { + bi.addClass(sourceInfo.clsName); + bi.addMethod(sourceInfo.clsName, sourceInfo.methodName, sourceInfo.signature, sourceInfo.isStatic); + bi.addSourceLine(sourceInfo.srcLine); + bi.addString(sourceInfos.getKey()); + } + } + + bugReporter.reportBug(bi); + } + } + } parmInfo.clear(); } + private KeyType isKeyAccessMethod(int seen) { + if (seen == INVOKEINTERFACE) { + String clsName = getClassConstantOperand(); + if (HTTP_SESSION.equals(clsName)) { + String methodName = getNameConstantOperand(); + if (GET_ATTRIBUTE.equals(methodName)) { + String signature = getSigConstantOperand(); + return (GET_ATTRIBUTE_SIG.equals(signature)) ? KeyType.ATTRIBUTE : null; + } else if (SET_ATTRIBUTE.equals(methodName)) { + String signature = getSigConstantOperand(); + return (SET_ATTRIBUTE_SIG.equals(signature)) ? KeyType.ATTRIBUTE : null; + } + } else if (HTTP_SERVLET_REQUEST.equals(clsName)) { + String methodName = getNameConstantOperand(); + if (GET_PARAMETER.equals(methodName)) { + String signature = getSigConstantOperand(); + return (GET_PARAMETER_SIG.equals(signature)) ? KeyType.PARAMETER : null; + } + } + } + + return null; + } /** * a holder for location information of a getParameter call */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2010-01-01 00:43:14
|
Revision: 1425 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1425&view=rev Author: dbrosius Date: 2010-01-01 00:42:50 +0000 (Fri, 01 Jan 2010) Log Message: ----------- (c) 2010 Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TailRecursion.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseSplit.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/AttributesUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/CodeByteUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/MapEntry.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/VersionTransition.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/build.xml 2010-01-01 00:42:50 UTC (rev 1425) @@ -152,7 +152,7 @@ destdir="${javadoc.dir}" windowtitle="fb-contrib api"> <doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle> - <bottom><![CDATA[<i>Copyright © 2005-2009 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> + <bottom><![CDATA[<i>Copyright © 2005-2010 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> </javadoc> </target> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2009 Bhaskar Maddala + * Copyright (C) 2010 Bhaskar Maddala * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java 2009-12-31 23:18:26 UTC (rev 1424) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java 2010-01-01 00:42:50 UTC (rev 1425) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2009 Dave Brosius + * Copyright (C) 2005-2010 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontr... [truncated message content] |
From: <dbr...@us...> - 2010-01-10 02:05:58
|
Revision: 1455 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1455&view=rev Author: dbrosius Date: 2010-01-10 02:05:50 +0000 (Sun, 10 Jan 2010) Log Message: ----------- split CVAA into two bug patterns, one for array assignment, one for element assignment Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2010-01-10 01:19:04 UTC (rev 1454) +++ trunk/fb-contrib/etc/findbugs.xml 2010-01-10 02:05:50 UTC (rev 1455) @@ -308,7 +308,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" - speed="fast" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" /> + speed="fast" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> @@ -566,6 +566,8 @@ category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="CVAA" type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="CVAA" type="CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" + category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="NFF" type="NFF_NON_FUNCTIONAL_FIELD" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="WNG" type="WNG_WRONG_NULL_FIELD_GUARD" Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2010-01-10 01:19:04 UTC (rev 1454) +++ trunk/fb-contrib/etc/messages.xml 2010-01-10 02:05:50 UTC (rev 1455) @@ -2782,13 +2782,33 @@ B[] b = new B[2]; A[] a = b; + </pre> + <p>It is a fast detector</p> + ]]> + </Details> + </BugPattern> + + <BugPattern type="CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT"> + <ShortDescription>method performs a contravariant array element assignment</ShortDescription> + <LongDescription>method {1} performs a contravariant array element assignment</LongDescription> + <Details> + <![CDATA[ + <p>This method contains a contravariant array element assignment. Since arrays are mutable + data structures, their use must be restricted to covariant or invariant usage</p> + + <pre> + class A {} + class B extends A {} + + B[] b = new B[2]; + A[] a = b; a[0] = new A(); // results in ArrayStoreException (Runtime) </pre> <p>It is a fast detector</p> ]]> </Details> </BugPattern> - + <BugPattern type="NFF_NON_FUNCTIONAL_FIELD"> <ShortDescription>serializable class defines a final transient field</ShortDescription> <LongDescription>serializable class {0} defines a final transient field</LongDescription> Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2010-01-10 01:19:04 UTC (rev 1454) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2010-01-10 02:05:50 UTC (rev 1455) @@ -153,22 +153,15 @@ return; } - if(isArrayType(sourceSignature)) { - if(!isArrayType(targetSignature)){ - bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", LOW_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } else { - if(isObjectType(sourceSignature) && isObjectType(targetSignature)){ - ObjectType sourceType = (ObjectType) ((ArrayType) Type.getType(sourceSignature)).getBasicType(); - ObjectType targetType = (ObjectType) ((ArrayType) Type.getType(targetSignature)).getBasicType(); - if(!targetType.equals(sourceType) && !targetType.subclassOf(sourceType)) { - bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - } + if(isArrayType(sourceSignature) && isArrayType(targetSignature)) { + if(isObjectType(sourceSignature) && isObjectType(targetSignature)) { + ObjectType sourceType = (ObjectType) ((ArrayType) Type.getType(sourceSignature)).getBasicType(); + ObjectType targetType = (ObjectType) ((ArrayType) Type.getType(targetSignature)).getBasicType(); + if(!targetType.equals(sourceType) && !targetType.subclassOf(sourceType)) { + bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT", 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. |