Thread: [Fb-contrib-commit] SF.net SVN: fb-contrib:[1812] trunk/fb-contrib (Page 6)
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2017-03-12 23:32:15
|
Revision: 1812
http://sourceforge.net/p/fb-contrib/code/1812
Author: dbrosius
Date: 2017-03-12 23:32:07 +0000 (Sun, 12 Mar 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.properties
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bugrank.txt
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/etc/samples.fbp
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JAXRSIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StringifiedTypes.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnitTestAssertionOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnsynchronizedSingletonFieldWrites.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/Values.java
trunk/fb-contrib/src/samples/java/BL_Sample.java
trunk/fb-contrib/src/samples/java/DMC_Sample.java
trunk/fb-contrib/src/samples/java/JXI_Sample.java
trunk/fb-contrib/src/samples/java/OCP_Sample.java
trunk/fb-contrib/src/samples/java/SJVU_Sample.java
trunk/fb-contrib/src/samples/java/SLS_Sample.java
trunk/fb-contrib/src/samples/java/SPP_Sample.java
trunk/fb-contrib/src/samples/java/STB_Sample.java
trunk/fb-contrib/src/samples/java/STT_Sample.java
trunk/fb-contrib/yank.xls
Removed Paths:
-------------
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/StatisticsKey.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/.classpath 2017-03-12 23:32:07 UTC (rev 1812)
@@ -5,8 +5,8 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" output="target/classes/test" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="lib/backport-util-concurrent-3.1.jar"/>
- <classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
+ <classpathentry kind="lib" path="lib/backport-util-concurrent-3.1.jar" sourcepath="/home/dave/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1-sources.jar"/>
+ <classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar" sourcepath="lib/sources/javax.servlet-api-3.1.0-sources.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/javax.servlet.jsp-api-2.3.1.jar"/>
<classpathentry kind="lib" path="lib/asm-debug-all-5.0.2.jar" sourcepath="lib/sources/asm-debug-all-5.0.2-sources.jar"/>
@@ -17,7 +17,6 @@
</classpathentry>
<classpathentry kind="lib" path="lib/findbugs-3.0.1.jar" sourcepath="lib/sources/findbugs-3.0.1-sources.jar"/>
<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
- <classpathentry kind="lib" path="lib/jsr311-api-1.1.1.jar" sourcepath="lib/sources/jsr311-api-1.1.1-sources.jar"/>
<classpathentry kind="lib" path="lib/javax.persistence-2.1.1.jar"/>
<classpathentry kind="lib" path="lib/mockito-all-2.0.2-beta.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
@@ -39,5 +38,7 @@
<classpathentry kind="lib" path="lib/testng-6.9.10.jar"/>
<classpathentry kind="lib" path="lib/jcommander-1.48.jar"/>
<classpathentry kind="lib" path="lib/commons-io-2.4.jar"/>
+ <classpathentry kind="lib" path="lib/jersey-media-multipart-2.25.1.jar"/>
+ <classpathentry kind="lib" path="lib/javax.ws.rs-api-2.0.1.jar"/>
<classpathentry kind="output" path="target/classes/main"/>
</classpath>
Modified: trunk/fb-contrib/build.properties
===================================================================
--- trunk/fb-contrib/build.properties 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/build.properties 2017-03-12 23:32:07 UTC (rev 1812)
@@ -1,6 +1,5 @@
-bin.includes = plugin.xml,\
- META-INF/,\
+bin.includes = plugin.xml
.
jars.compile.order = .
source.. = src/main/java,\
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/build.xml 2017-03-12 23:32:07 UTC (rev 1812)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="6.8.3" />
+ <property name="fb-contrib.version" value="6.8.4" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -130,7 +130,6 @@
<pathelement location="${lib.dir}/httpcore-${httpcore.version}.jar" />
<pathelement location="${lib.dir}/httpclient-${httpclient.version}.jar" />
<pathelement location="${lib.dir}/commons-codec-${commons-codec.version}.jar" />
- <pathelement location="${lib.dir}/jsr311-api-${jsr311-api.version}.jar" />
<pathelement location="${lib.dir}/spring-beans-${spring-beans.version}.jar" />
<pathelement location="${lib.dir}/spring-context-${spring-context.version}.jar" />
<pathelement location="${lib.dir}/spring-tx-${spring-tx.version}.jar" />
@@ -137,6 +136,8 @@
<pathelement location="${lib.dir}/javax.persistence-${javax.persistence.version}.jar" />
<pathelement location="${lib.dir}/mockito-all-${mockito-all.version}.jar" />
<pathelement location="${lib.dir}/jena-shaded-guava-${jena-shaded-guava.version}.jar" />
+ <pathelement location="${lib.dir}/javax.ws.rs-api-${javax.ws.rs-api.version}.jar" />
+ <pathelement location="${lib.dir}/jersey-media-multipart-${jersey-media-multipart.version}.jar" />
</path>
</target>
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/etc/bugrank.txt 2017-03-12 23:32:07 UTC (rev 1812)
@@ -200,6 +200,7 @@
+0 BugPattern SPP_NON_USEFUL_TOSTRING
+0 BugPattern SPP_NO_CHAR_SB_CTOR
+0 BugPattern SPP_NULL_BEFORE_INSTANCEOF
++0 BugPattern SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR
+0 BugPattern SPP_NULL_CHECK_ON_OPTIONAL
+0 BugPattern SPP_SERIALVER_SHOULD_BE_PRIVATE
+0 BugPattern SPP_STATIC_FORMAT_STRING
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-03-12 23:32:07 UTC (rev 1812)
@@ -145,7 +145,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SCRV_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_TERNARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_SERIALVER_SHOULD_BE_PRIVATE,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_NULL_CHECK_ON_OPTIONAL,SPP_WRONG_COMMONS_TO_STRING_OBJECT" />
+ 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_TERNARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_SERIALVER_SHOULD_BE_PRIVATE,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_NULL_CHECK_ON_OPTIONAL,SPP_WRONG_COMMONS_TO_STRING_OBJECT,SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" />
@@ -428,6 +428,7 @@
<BugPattern abbrev="SPP" type="SPP_STATIC_FORMAT_STRING" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_NULL_CHECK_ON_OPTIONAL" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_WRONG_COMMONS_TO_STRING_OBJECT" category="CORRECTNESS" />
+ <BugPattern abbrev="SPP" type="SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR" category="CORRECTNESS" />
<BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" />
<BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" 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 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/etc/messages.xml 2017-03-12 23:32:07 UTC (rev 1812)
@@ -774,7 +774,8 @@
compiled. This can happen if you specify the <code>-source</code> and <code>-target</code> options of the javac compiler, and
specify a target that is less than the JDK version of the javac compiler.</p>
<p>It relies on the system property <code>-Dfb-contrib.sjvu.jdkhome=/path/to/older/jdk/to/check"</code> to specify
- what JDK to compare against. If this property is not set, this detector does nothing.</p>
+ what JDK to compare against. On linux, you may need to give file permissions to findbugs to read these directories.
+ If this property is not set, this detector does nothing.</p>
<p>It is a slow detector.</p>
]]>
</Details>
@@ -3432,7 +3433,7 @@
<ShortDescription>Method does not pass an object to commons-lang's ToStringBuilder</ShortDescription>
<LongDescription>Method {1} does not pass an object to commons-lang's ToStringBuilder</LongDescription>
<Details>
- <![CDATA[[
+ <![CDATA[
This method uses commons-lang, or commons-lang3's ToStringBuilder to attempt to output a representation of an object.
However, no object was passed, just the style specifier, and so the output will be of the ToStringStyle object itself.
Don't forget to include the object you wish to output as the first parameter, such as
@@ -3442,6 +3443,18 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR">
+ <ShortDescription>Method checks whether the keySet(), entrySet() or values() collection of a Map is null</ShortDescription>
+ <LongDescription>Method {1} checks whether the keySet(), entrySet() or values() collection of a Map is null</LongDescription>
+ <Details>
+ <![CDATA[
+ This method checks to see if the return value from a keySet(), entrySet() or values() method call on a Map is null.
+ For any valid functioning Map these collections will always be non-null, and so the call is superfluous. Maybe you intended
+ to check whether those sets where empty() instead.
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE">
<ShortDescription>Method assigns a variable in a larger scope than is needed</ShortDescription>
@@ -5899,6 +5912,6 @@
<BugCode abbrev="CCI">Concurrent Collection Issues</BugCode>
<BugCode abbrev="UTWR">Use Try With Resources</BugCode>
<BugCode abbrev="SSCU">Suspicious Shaded Class Use</BugCode>
- <BugCode abbrev="USFW">Unsynchronous Singleton Field Writes</BugCode>
+ <BugCode abbrev="USFW">Unsynchronized Singleton Field Writes</BugCode>
<BugCode abbrev="OI">Optional Issues</BugCode>
</MessageCollection>
Modified: trunk/fb-contrib/etc/samples.fbp
===================================================================
--- trunk/fb-contrib/etc/samples.fbp 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/etc/samples.fbp 2017-03-12 23:32:07 UTC (rev 1812)
@@ -1,28 +1,29 @@
<Project projectName="sample">
- <Jar>./../target/classes/samples</Jar>
- <AuxClasspathEntry>./../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/commons-codec-1.10.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/commons-collections-3.2.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/commons-lang3-3.4.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/guava-19.0.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/httpclient-4.5.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/httpclient-cache-4.5.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/httpcore-4.4.5.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/jsr311-api-1.1.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/junit-4.12.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/log4j-1.2.17.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/slf4j-api-1.7.21.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/threetenbp-1.3.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/commons-io-2.4.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/testng-6.9.10.jar</AuxClasspathEntry>
- <SrcDir>../src/samples/java</SrcDir>
+ <Jar>././../target/classes/samples</Jar>
+ <AuxClasspathEntry>././../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/commons-codec-1.10.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/commons-collections-3.2.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/commons-lang3-3.4.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/guava-19.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/httpclient-4.5.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/httpclient-cache-4.5.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/httpcore-4.4.5.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/junit-4.12.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/log4j-1.2.17.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/slf4j-api-1.7.21.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/threetenbp-1.3.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/commons-io-2.4.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/testng-6.9.10.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry>
+ <SrcDir>./../src/samples/java</SrcDir>
</Project>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/htdocs/index.shtml 2017-03-12 23:32:07 UTC (rev 1812)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.3 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.4 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
@@ -77,9 +77,9 @@
</div>
<hr/>
- <img id="git_image" src="flip1.gif" onClick="toggleBlock('git', 'git_image');" align="top"/>
+ <img id="git_image" src="flip2.gif" onClick="toggleBlock('git', 'git_image');" align="top"/>
Detectors added in git<br/>
- <div id="git" style="display:none;">
+ <div id="git" style="display:block;">
<ul>
<li><b>[UTWR] Use Try With Resources</b><br/>
Looks for try/finally blocks that manage resources, without using try-with-resources.
@@ -88,12 +88,18 @@
Looks for use of classes that have been shaded into 3rdparty jars, rather than using the
real class, from the real jar.
</li>
+ <li><b>[USFW] Unsynchronized Singleton Field Writes</b><br/>
+ Looks for field writes to objects that are non singletons, where the write is not synchronized
+ </li>
+ <li><b>[OI] Optional Issues</b><br/>
+ Looks for various issues around use of java.util.Optional
+ </li>
</ul>
</div>
<hr/>
- <img id="git_image" src="flip2.gif" onClick="toggleBlock('v6_8_0', 'v6_8_0_image');" align="top"/>
+ <img id="git_image" src="flip1.gif" onClick="toggleBlock('v6_8_0', 'v6_8_0_image');" align="top"/>
Detectors added in v6.8.0<br/>
- <div id="v6_8_0" style="display:block;">
+ <div id="v6_8_0" style="display:none;">
<ul>
<li><b>[DMC] Dubious Map Collection</b><br/>
Looks for fields that are implementations of java.util.Map, but that are only ever iterated over. This probably means that this
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/htdocs/repository.html 2017-03-12 23:32:07 UTC (rev 1812)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>6.8.3</td></tr>
+ <tr><td><b>Version:</b></td><td>6.8.4</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/pom.xml 2017-03-12 23:32:07 UTC (rev 1812)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>6.8.3</version>
+ <version>6.8.4</version>
<prerequisites>
<maven>2.2.1</maven>
@@ -148,10 +148,9 @@
<dependency><scope>test</scope><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.10</version></dependency>
<dependency><scope>test</scope><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.4</version></dependency>
<dependency><scope>test</scope><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2.2</version></dependency>
- <dependency><scope>test</scope><groupId>javax.persistence</groupId><artifactId>persistence-api</artifactId><version>1.0.2</version></dependency>
<dependency><scope>test</scope><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.1.0</version></dependency>
<dependency><scope>test</scope><groupId>javax.servlet.jsp</groupId><artifactId>javax.servlet.jsp-api</artifactId><version>2.3.1</version></dependency>
- <dependency><scope>test</scope><groupId>javax.ws.rs</groupId><artifactId>jsr311-api</artifactId><version>1.1.1</version></dependency>
+ <dependency><scope>test</scope><groupId>javax.ws.rs</groupId><artifactId>javax.ws.rs-api</artifactId><version>2.0.1</version></dependency>
<dependency><scope>test</scope><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency>
<dependency><scope>test</scope><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency>
<dependency><scope>test</scope><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.3</version></dependency>
@@ -185,6 +184,18 @@
<version>3.1.0</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-multipart</artifactId>
+ <version>2.25.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>javax.persistence</artifactId>
+ <version>2.1.1</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Modified: trunk/fb-contrib/samples.xml
===================================================================
--- trunk/fb-contrib/samples.xml 2017-02-12 16:42:47 UTC (rev 1811)
+++ trunk/fb-contrib/samples.xml 2017-03-12 23:32:07 UTC (rev 1812)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<BugCollection version="3.0.1" sequence="0" timestamp="1486772460637" analysisTimestamp="1486772460662" release="">
+<BugCollection version="3.0.1" sequence="0" timestamp="1489328062955" analysisTimestamp="1489328062981" release="">
<Project projectName="Samples">
<Jar>/home/dave/dev/fb-contrib/target/classes/samples</Jar>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry>
@@ -19,7 +19,7 @@
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/httpcore-4.4.5.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/httpclient-4.5.2.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/commons-codec-1.10.jar</AuxClasspathEntry>
- <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jsr311-api-1.1.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jsr311-api-${jsr311-api.version}.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry>
@@ -26,6 +26,8 @@
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/javax.persistence-2.1.1.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry>
</Project>
<BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="52beb96b508e41498d672e105e62ceda" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
<ShortMessage>Class is defined in the default package</ShortMessage>
@@ -155,13 +157,13 @@
<ShortMessage>Class is defined in the default package</ShortMessage>
<LongMessage>Class ABC_Sample$UseComparator$1 id defined in the default package</LongMessage>
<Class classname="ABC_Sample$UseComparator$1" primary="true">
- <SourceLine classname="ABC_Sample$UseComparator$1" start="30" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java">
- <Message>At ABC_Sample.java:[lines 30-33]</Message>
+ <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java">
+ <Message>At ABC_Sample.java:[lines 1-33]</Message>
</SourceLine>
<Message>In class ABC_Sample$UseComparator$1</Message>
</Class>
- <SourceLine classname="ABC_Sample$UseComparator$1" start="30" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true">
- <Message>At ABC_Sample.java:[lines 30-33]</Message>
+ <SourceLine classname="ABC_Sample$UseComparator$1" start="1" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java" synthetic="true">
+ <Message>At ABC_Sample.java:[lines 1-33]</Message>
</SourceLine>
</BugInstance>
<BugInstance type="SIC_INNER_SHOULD_BE_STATIC_ANON" priority="3" rank="20" abbrev="SIC" category="PERFORMANCE" instanceHash="9296dd6a3b1f76793e436f0b899dac" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
@@ -168,13 +170,13 @@
<ShortMessage>Could be refactored into a named static inner class</ShortMessage>
<LongMessage>The class ABC_Sample$UseComparator$1 could be refactored into a named _static_ inner class</LongMessage>
<Class classname="ABC_Sample$UseComparator$1" primary="true">
- <SourceLine classname="ABC_Sample$UseComparator$1" start="30" end="33" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java">
- <Message>At ABC_Sample.java:[lines 30-33]</Message>
+ <SourceLine classname="ABC_Sample$UseCompa...
[truncated message content] |
|
From: <dbr...@us...> - 2017-04-09 22:42:36
|
Revision: 1816
http://sourceforge.net/p/fb-contrib/code/1816
Author: dbrosius
Date: 2017-04-09 22:42:29 +0000 (Sun, 09 Apr 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/HangingExecutors.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseAddAll.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WiringIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/QMethod.java
Added Paths:
-----------
trunk/fb-contrib/src/samples/java/ex/
trunk/fb-contrib/src/samples/java/ex/ABC_Sample.java
trunk/fb-contrib/src/samples/java/ex/ACEM_Sample.java
trunk/fb-contrib/src/samples/java/ex/AFBR_Sample.java
trunk/fb-contrib/src/samples/java/ex/AIOB_Sample.java
trunk/fb-contrib/src/samples/java/ex/AOM_Sample.java
trunk/fb-contrib/src/samples/java/ex/AWCBR_Sample.java
trunk/fb-contrib/src/samples/java/ex/BAS_Sample.java
trunk/fb-contrib/src/samples/java/ex/BED_Sample.java
trunk/fb-contrib/src/samples/java/ex/BL_Sample.java
trunk/fb-contrib/src/samples/java/ex/BRPI_Sample.java
trunk/fb-contrib/src/samples/java/ex/BSB_Sample.java
trunk/fb-contrib/src/samples/java/ex/CAAL_Sample.java
trunk/fb-contrib/src/samples/java/ex/CAO_Sample.java
trunk/fb-contrib/src/samples/java/ex/CBC_Sample.java
trunk/fb-contrib/src/samples/java/ex/CBX_Sample.java
trunk/fb-contrib/src/samples/java/ex/CCI_Sample.java
trunk/fb-contrib/src/samples/java/ex/CCNE_Sample.java
trunk/fb-contrib/src/samples/java/ex/CEBE_EqualsToEqualsSample.java
trunk/fb-contrib/src/samples/java/ex/CE_Sample.java
trunk/fb-contrib/src/samples/java/ex/CFS_Sample.java
trunk/fb-contrib/src/samples/java/ex/CHBH_HashcodeToHashcodeSample.java
trunk/fb-contrib/src/samples/java/ex/CLI_Sample.java
trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java
trunk/fb-contrib/src/samples/java/ex/COM_Sample.java
trunk/fb-contrib/src/samples/java/ex/CRF_Sample.java
trunk/fb-contrib/src/samples/java/ex/CSBTS_StringToStringSample.java
trunk/fb-contrib/src/samples/java/ex/CSI_Sample.java
trunk/fb-contrib/src/samples/java/ex/CTU_Sample.java
trunk/fb-contrib/src/samples/java/ex/CU_Sample.java
trunk/fb-contrib/src/samples/java/ex/CVAA_Sample.java
trunk/fb-contrib/src/samples/java/ex/DDC_Sample.java
trunk/fb-contrib/src/samples/java/ex/DLC_Sample.java
trunk/fb-contrib/src/samples/java/ex/DMC_Sample.java
trunk/fb-contrib/src/samples/java/ex/DRE_Sample.java
trunk/fb-contrib/src/samples/java/ex/DSOC_Sample.java
trunk/fb-contrib/src/samples/java/ex/DTEP_Sample.java
trunk/fb-contrib/src/samples/java/ex/DWI_Sample.java
trunk/fb-contrib/src/samples/java/ex/EXS_Sample.java
trunk/fb-contrib/src/samples/java/ex/FCBL_Sample.java
trunk/fb-contrib/src/samples/java/ex/FCCD_Sample.java
trunk/fb-contrib/src/samples/java/ex/FPL_Sample.java
trunk/fb-contrib/src/samples/java/ex/FP_Sample.java
trunk/fb-contrib/src/samples/java/ex/HCP_Sample.java
trunk/fb-contrib/src/samples/java/ex/HES_Sample.java
trunk/fb-contrib/src/samples/java/ex/ICA_Sample.java
trunk/fb-contrib/src/samples/java/ex/IICU_Sample.java
trunk/fb-contrib/src/samples/java/ex/IKNC_Sample.java
trunk/fb-contrib/src/samples/java/ex/IMC_Sample.java
trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java
trunk/fb-contrib/src/samples/java/ex/IPU_Sample.java
trunk/fb-contrib/src/samples/java/ex/ISB_Sample.java
trunk/fb-contrib/src/samples/java/ex/ITC_Sample.java
trunk/fb-contrib/src/samples/java/ex/ITU_Sample.java
trunk/fb-contrib/src/samples/java/ex/JPAI_Sample.java
trunk/fb-contrib/src/samples/java/ex/JVR_Sample.java
trunk/fb-contrib/src/samples/java/ex/JXI_Sample.java
trunk/fb-contrib/src/samples/java/ex/LEST_Sample.java
trunk/fb-contrib/src/samples/java/ex/LGO_Sample.java
trunk/fb-contrib/src/samples/java/ex/LII_Sample.java
trunk/fb-contrib/src/samples/java/ex/LO_Sample.java
trunk/fb-contrib/src/samples/java/ex/LSC_Sample.java
trunk/fb-contrib/src/samples/java/ex/LSYC_Sample.java
trunk/fb-contrib/src/samples/java/ex/MAC_Sample.java
trunk/fb-contrib/src/samples/java/ex/MDM_Sample.java
trunk/fb-contrib/src/samples/java/ex/MOM_Sample.java
trunk/fb-contrib/src/samples/java/ex/MRC_Sample.java
trunk/fb-contrib/src/samples/java/ex/MTA_Sample.java
trunk/fb-contrib/src/samples/java/ex/MUC_Sample.java
trunk/fb-contrib/src/samples/java/ex/NAB_Sample.java
trunk/fb-contrib/src/samples/java/ex/NCMU_Sample.java
trunk/fb-contrib/src/samples/java/ex/NCS_Sample.java
trunk/fb-contrib/src/samples/java/ex/NFF_Sample.java
trunk/fb-contrib/src/samples/java/ex/NIR_Sample.java
trunk/fb-contrib/src/samples/java/ex/NMCS_Sample.java
trunk/fb-contrib/src/samples/java/ex/NOS_Sample.java
trunk/fb-contrib/src/samples/java/ex/NPMC_Sample.java
trunk/fb-contrib/src/samples/java/ex/NRTL_Sample.java
trunk/fb-contrib/src/samples/java/ex/NSE_Sample.java
trunk/fb-contrib/src/samples/java/ex/OCP_Sample.java
trunk/fb-contrib/src/samples/java/ex/OC_Sample.java
trunk/fb-contrib/src/samples/java/ex/ODN_Sample.java
trunk/fb-contrib/src/samples/java/ex/OI_Sample.java
trunk/fb-contrib/src/samples/java/ex/OPM_Sample.java
trunk/fb-contrib/src/samples/java/ex/PCAIL_Sample.java
trunk/fb-contrib/src/samples/java/ex/PCOA_Sample.java
trunk/fb-contrib/src/samples/java/ex/PDP_Sample.java
trunk/fb-contrib/src/samples/java/ex/PIS_Sample.java
trunk/fb-contrib/src/samples/java/ex/PL_Sample.java
trunk/fb-contrib/src/samples/java/ex/PMB_Sample.java
trunk/fb-contrib/src/samples/java/ex/PME_Sample.java
trunk/fb-contrib/src/samples/java/ex/PRMC_Sample.java
trunk/fb-contrib/src/samples/java/ex/PSC_Sample.java
trunk/fb-contrib/src/samples/java/ex/PUS_Sample.java
trunk/fb-contrib/src/samples/java/ex/ROOM_Sample.java
trunk/fb-contrib/src/samples/java/ex/S508C_Sample.java
trunk/fb-contrib/src/samples/java/ex/SACM_Sample.java
trunk/fb-contrib/src/samples/java/ex/SCA_Sample.java
trunk/fb-contrib/src/samples/java/ex/SCII_Sample.java
trunk/fb-contrib/src/samples/java/ex/SCI_Sample.java
trunk/fb-contrib/src/samples/java/ex/SCRV_Sample.java
trunk/fb-contrib/src/samples/java/ex/SCR_Sample.java
trunk/fb-contrib/src/samples/java/ex/SCSS_Sample.java
trunk/fb-contrib/src/samples/java/ex/SEC_Sample.java
trunk/fb-contrib/src/samples/java/ex/SEO_Sample.java
trunk/fb-contrib/src/samples/java/ex/SGSU_Sample.java
trunk/fb-contrib/src/samples/java/ex/SG_Sample.java
trunk/fb-contrib/src/samples/java/ex/SIL_Sample.java
trunk/fb-contrib/src/samples/java/ex/SJVU_Sample.java
trunk/fb-contrib/src/samples/java/ex/SLS_Sample.java
trunk/fb-contrib/src/samples/java/ex/SMII_Sample.java
trunk/fb-contrib/src/samples/java/ex/SNG_Sample.java
trunk/fb-contrib/src/samples/java/ex/SPP_Sample.java
trunk/fb-contrib/src/samples/java/ex/SSCU_Sample.java
trunk/fb-contrib/src/samples/java/ex/STB_Sample.java
trunk/fb-contrib/src/samples/java/ex/STS_Sample.java
trunk/fb-contrib/src/samples/java/ex/STT_Sample.java
trunk/fb-contrib/src/samples/java/ex/SUA_Sample.java
trunk/fb-contrib/src/samples/java/ex/SWCO_Sample.java
trunk/fb-contrib/src/samples/java/ex/TBP_Sample.java
trunk/fb-contrib/src/samples/java/ex/TR_Sample.java
trunk/fb-contrib/src/samples/java/ex/UAA_Sample.java
trunk/fb-contrib/src/samples/java/ex/UCC_Sample.java
trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java
trunk/fb-contrib/src/samples/java/ex/UEC_Sample.java
trunk/fb-contrib/src/samples/java/ex/UMTP_Sample.java
trunk/fb-contrib/src/samples/java/ex/UNNC_Sample.java
trunk/fb-contrib/src/samples/java/ex/UP_Sample.java
trunk/fb-contrib/src/samples/java/ex/URV_Sample.java
trunk/fb-contrib/src/samples/java/ex/USBR_Sample.java
trunk/fb-contrib/src/samples/java/ex/USFW_Sample.java
trunk/fb-contrib/src/samples/java/ex/USS_Sample.java
trunk/fb-contrib/src/samples/java/ex/UTAO_Sample.java
trunk/fb-contrib/src/samples/java/ex/UTA_Sample.java
trunk/fb-contrib/src/samples/java/ex/UTWR_Sample.java
trunk/fb-contrib/src/samples/java/ex/UVA_Sample.java
trunk/fb-contrib/src/samples/java/ex/WEM_Sample.java
trunk/fb-contrib/src/samples/java/ex/WI_Sample.java
trunk/fb-contrib/src/samples/java/ex/WOC_Sample.java
Removed Paths:
-------------
trunk/fb-contrib/src/samples/java/ABC_Sample.java
trunk/fb-contrib/src/samples/java/ACEM_Sample.java
trunk/fb-contrib/src/samples/java/AFBR_Sample.java
trunk/fb-contrib/src/samples/java/AIOB_Sample.java
trunk/fb-contrib/src/samples/java/AOM_Sample.java
trunk/fb-contrib/src/samples/java/AWCBR_Sample.java
trunk/fb-contrib/src/samples/java/BAS_Sample.java
trunk/fb-contrib/src/samples/java/BED_Sample.java
trunk/fb-contrib/src/samples/java/BL_Sample.java
trunk/fb-contrib/src/samples/java/BRPI_Sample.java
trunk/fb-contrib/src/samples/java/BSB_Sample.java
trunk/fb-contrib/src/samples/java/CAAL_Sample.java
trunk/fb-contrib/src/samples/java/CAO_Sample.java
trunk/fb-contrib/src/samples/java/CBC_Sample.java
trunk/fb-contrib/src/samples/java/CBX_Sample.java
trunk/fb-contrib/src/samples/java/CCI_Sample.java
trunk/fb-contrib/src/samples/java/CCNE_Sample.java
trunk/fb-contrib/src/samples/java/CEBE_EqualsToEqualsSample.java
trunk/fb-contrib/src/samples/java/CE_Sample.java
trunk/fb-contrib/src/samples/java/CFS_Sample.java
trunk/fb-contrib/src/samples/java/CHBH_HashcodeToHashcodeSample.java
trunk/fb-contrib/src/samples/java/CLI_Sample.java
trunk/fb-contrib/src/samples/java/CNC_Sample.java
trunk/fb-contrib/src/samples/java/COM_Sample.java
trunk/fb-contrib/src/samples/java/CRF_Sample.java
trunk/fb-contrib/src/samples/java/CSBTS_StringToStringSample.java
trunk/fb-contrib/src/samples/java/CSI_Sample.java
trunk/fb-contrib/src/samples/java/CTU_Sample.java
trunk/fb-contrib/src/samples/java/CU_Sample.java
trunk/fb-contrib/src/samples/java/CVAA_Sample.java
trunk/fb-contrib/src/samples/java/DDC_Sample.java
trunk/fb-contrib/src/samples/java/DLC_Sample.java
trunk/fb-contrib/src/samples/java/DMC_Sample.java
trunk/fb-contrib/src/samples/java/DRE_Sample.java
trunk/fb-contrib/src/samples/java/DSOC_Sample.java
trunk/fb-contrib/src/samples/java/DTEP_Sample.java
trunk/fb-contrib/src/samples/java/DWI_Sample.java
trunk/fb-contrib/src/samples/java/EXS_Sample.java
trunk/fb-contrib/src/samples/java/FCBL_Sample.java
trunk/fb-contrib/src/samples/java/FCCD_Sample.java
trunk/fb-contrib/src/samples/java/FPL_Sample.java
trunk/fb-contrib/src/samples/java/FP_Sample.java
trunk/fb-contrib/src/samples/java/HCP_Sample.java
trunk/fb-contrib/src/samples/java/HES_Sample.java
trunk/fb-contrib/src/samples/java/ICA_Sample.java
trunk/fb-contrib/src/samples/java/IICU_Sample.java
trunk/fb-contrib/src/samples/java/IKNC_Sample.java
trunk/fb-contrib/src/samples/java/IMC_Sample.java
trunk/fb-contrib/src/samples/java/IOI_Sample.java
trunk/fb-contrib/src/samples/java/IPU_Sample.java
trunk/fb-contrib/src/samples/java/ISB_Sample.java
trunk/fb-contrib/src/samples/java/ITC_Sample.java
trunk/fb-contrib/src/samples/java/ITU_Sample.java
trunk/fb-contrib/src/samples/java/JPAI_Sample.java
trunk/fb-contrib/src/samples/java/JVR_Sample.java
trunk/fb-contrib/src/samples/java/JXI_Sample.java
trunk/fb-contrib/src/samples/java/LEST_Sample.java
trunk/fb-contrib/src/samples/java/LGO_Sample.java
trunk/fb-contrib/src/samples/java/LII_Sample.java
trunk/fb-contrib/src/samples/java/LO_Sample.java
trunk/fb-contrib/src/samples/java/LSC_Sample.java
trunk/fb-contrib/src/samples/java/LSYC_Sample.java
trunk/fb-contrib/src/samples/java/MAC_Sample.java
trunk/fb-contrib/src/samples/java/MDM_Sample.java
trunk/fb-contrib/src/samples/java/MOM_Sample.java
trunk/fb-contrib/src/samples/java/MRC_Sample.java
trunk/fb-contrib/src/samples/java/MTA_Sample.java
trunk/fb-contrib/src/samples/java/MUC_Sample.java
trunk/fb-contrib/src/samples/java/NAB_Sample.java
trunk/fb-contrib/src/samples/java/NCMU_Sample.java
trunk/fb-contrib/src/samples/java/NCS_Sample.java
trunk/fb-contrib/src/samples/java/NFF_Sample.java
trunk/fb-contrib/src/samples/java/NIR_Sample.java
trunk/fb-contrib/src/samples/java/NMCS_Sample.java
trunk/fb-contrib/src/samples/java/NOS_Sample.java
trunk/fb-contrib/src/samples/java/NPMC_Sample.java
trunk/fb-contrib/src/samples/java/NRTL_Sample.java
trunk/fb-contrib/src/samples/java/NSE_Sample.java
trunk/fb-contrib/src/samples/java/OCP_Sample.java
trunk/fb-contrib/src/samples/java/OC_Sample.java
trunk/fb-contrib/src/samples/java/ODN_Sample.java
trunk/fb-contrib/src/samples/java/OI_Sample.java
trunk/fb-contrib/src/samples/java/OPM_Sample.java
trunk/fb-contrib/src/samples/java/PCAIL_Sample.java
trunk/fb-contrib/src/samples/java/PCOA_Sample.java
trunk/fb-contrib/src/samples/java/PDP_Sample.java
trunk/fb-contrib/src/samples/java/PIS_Sample.java
trunk/fb-contrib/src/samples/java/PL_Sample.java
trunk/fb-contrib/src/samples/java/PMB_Sample.java
trunk/fb-contrib/src/samples/java/PME_Sample.java
trunk/fb-contrib/src/samples/java/PRMC_Sample.java
trunk/fb-contrib/src/samples/java/PSC_Sample.java
trunk/fb-contrib/src/samples/java/PUS_Sample.java
trunk/fb-contrib/src/samples/java/ROOM_Sample.java
trunk/fb-contrib/src/samples/java/S508C_Sample.java
trunk/fb-contrib/src/samples/java/SACM_Sample.java
trunk/fb-contrib/src/samples/java/SCA_Sample.java
trunk/fb-contrib/src/samples/java/SCII_Sample.java
trunk/fb-contrib/src/samples/java/SCI_Sample.java
trunk/fb-contrib/src/samples/java/SCRV_Sample.java
trunk/fb-contrib/src/samples/java/SCR_Sample.java
trunk/fb-contrib/src/samples/java/SCSS_Sample.java
trunk/fb-contrib/src/samples/java/SEC_Sample.java
trunk/fb-contrib/src/samples/java/SEO_Sample.java
trunk/fb-contrib/src/samples/java/SGSU_Sample.java
trunk/fb-contrib/src/samples/java/SG_Sample.java
trunk/fb-contrib/src/samples/java/SIL_Sample.java
trunk/fb-contrib/src/samples/java/SJVU_Sample.java
trunk/fb-contrib/src/samples/java/SLS_Sample.java
trunk/fb-contrib/src/samples/java/SMII_Sample.java
trunk/fb-contrib/src/samples/java/SNG_Sample.java
trunk/fb-contrib/src/samples/java/SPP_Sample.java
trunk/fb-contrib/src/samples/java/SSCU_Sample.java
trunk/fb-contrib/src/samples/java/STB_Sample.java
trunk/fb-contrib/src/samples/java/STS_Sample.java
trunk/fb-contrib/src/samples/java/STT_Sample.java
trunk/fb-contrib/src/samples/java/SUA_Sample.java
trunk/fb-contrib/src/samples/java/SWCO_Sample.java
trunk/fb-contrib/src/samples/java/TBP_Sample.java
trunk/fb-contrib/src/samples/java/TR_Sample.java
trunk/fb-contrib/src/samples/java/UAA_Sample.java
trunk/fb-contrib/src/samples/java/UCC_Sample.java
trunk/fb-contrib/src/samples/java/UCPM_Sample.java
trunk/fb-contrib/src/samples/java/UEC_Sample.java
trunk/fb-contrib/src/samples/java/UMTP_Sample.java
trunk/fb-contrib/src/samples/java/UNNC_Sample.java
trunk/fb-contrib/src/samples/java/UP_Sample.java
trunk/fb-contrib/src/samples/java/URV_Sample.java
trunk/fb-contrib/src/samples/java/USBR_Sample.java
trunk/fb-contrib/src/samples/java/USFW_Sample.java
trunk/fb-contrib/src/samples/java/USS_Sample.java
trunk/fb-contrib/src/samples/java/UTAO_Sample.java
trunk/fb-contrib/src/samples/java/UTA_Sample.java
trunk/fb-contrib/src/samples/java/UTWR_Sample.java
trunk/fb-contrib/src/samples/java/UVA_Sample.java
trunk/fb-contrib/src/samples/java/WEM_Sample.java
trunk/fb-contrib/src/samples/java/WI_Sample.java
trunk/fb-contrib/src/samples/java/WOC_Sample.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-03-12 23:39:23 UTC (rev 1815)
+++ trunk/fb-contrib/build.xml 2017-04-09 22:42:29 UTC (rev 1816)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="6.8.4" />
+ <property name="fb-contrib.version" value="6.9.0-SNAPSHOT" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-03-12 23:39:23 UTC (rev 1815)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-04-09 22:42:29 UTC (rev 1816)
@@ -20,7 +20,7 @@
<!-- Detectors -->
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
@@ -30,7 +30,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
@@ -305,7 +305,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues" speed="fast" reports="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY"/>
- <!-- COMMENT OUT FOR POINT RELEASE
+ <!-- COMMENT OUT FOR POINT RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/>
@@ -315,7 +315,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED"/>
- COMMENT OUT FOR POINT RELEASE -->
+ <!-- COMMENT OUT FOR POINT RELEASE -->
<!-- BugPattern -->
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2017-03-12 23:39:23 UTC (rev 1815)
+++ trunk/fb-contrib/etc/messages.xml 2017-04-09 22:42:29 UTC (rev 1816)
@@ -5638,7 +5638,7 @@
<![CDATA[
<p>Looks for relatively large if blocks of code, where you unconditionally return from them, and then follow that with an unconditional
return of a small block. This places the bulk of the logic to the right indentation-wise, making it more difficult to read than needed.
- It would be better to invert the logic of the if block, and immediately return, allowing the bulk of the logic to be move to the left,
+ It would be better to invert the logic of the if block, and immediately return, allowing the bulk of the logic to be move to the left
for easier reading.</p>
]]>
</Details>
@@ -5649,9 +5649,9 @@
<LongDescription>Class {0} auto wires the same object into two separate fields in a class hierarchy</LongDescription>
<Details>
<![CDATA[
- <p>this class has two fields in either itself or a parent class which autowire (without specialization, the same object
- for both fields. This is likely caused by a developer just not being aware that the field already is available for you use,
- and just causes wasted space, and confusing code access the same object through two different pathways.</p>
+ <p>this class has two fields in either itself or a parent class which autowire (without specialization), the same object
+ for both fields. This is likely caused by a developer just not being aware that the field already is available for your use,
+ and just causes wasted space, and confusing code access to the same object through two different pathways.</p>
]]>
</Details>
</BugPattern>
@@ -5662,7 +5662,7 @@
<Details>
<![CDATA[
<p>This method retrieves the value of a key from a ConcurrentHashMap, where the value is itself a collection. It checks this
- value for null, and if it is so, creates a new collection and places in the map. This may cause thread race conditions
+ value for null, and if it is so, creates a new collection and places it in the map. This may cause thread race conditions
where two threads overwrite each other's values. You should be using
<code>
ConcurrentHashMap.putIfAbsent(K, V)
@@ -5677,9 +5677,9 @@
<LongDescription>Method {1} manually handles closing an auto-closeable resource</LongDescription>
<Details>
<![CDATA[[
- <p>This method allocates and uses a auto closeable resources. However it manually closes the resource in a finally block.
+ <p>This method allocates and uses an auto closeable resources. However it manually closes the resource in a finally block.
While this is correct management, it doesn't rely on the Idiomatic way available to JDK 7 and above, and allows for possible
- subtle problems, and complicates the reading of code, by developers expecting the use of try-with-resources.
+ subtle problems, and complicates the reading of code by developers expecting the use of try-with-resources.
</p>
<p>Switch to using try with resources, as:
<pre>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-03-12 23:39:23 UTC (rev 1815)
+++ trunk/fb-contrib/pom.xml 2017-04-09 22:42:29 UTC (rev 1816)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>6.8.4</version>
+ <version>6.9.0-SNAPSHOT</version>
<prerequisites>
<maven>2.2.1</maven>
Modified: trunk/fb-contrib/samples.xml
===================================================================
--- trunk/fb-contrib/samples.xml 2017-03-12 23:39:23 UTC (rev 1815)
+++ trunk/fb-contrib/samples.xml 2017-04-09 22:42:29 UTC (rev 1816)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<BugCollection version="3.0.1" sequence="0" timestamp="1489328062955" analysisTimestamp="1489328062981" release="">
+<BugCollection version="3.0.1" sequence="0" timestamp="1491777371371" analysisTimestamp="1491777371509" release="">
<Project projectName="Samples">
<Jar>/home/dave/dev/fb-contrib/target/classes/samples</Jar>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry>
@@ -19,7 +19,6 @@
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/httpcore-4.4.5.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/httpclient-4.5.2.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/commons-codec-1.10.jar</AuxClasspathEntry>
- <AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jsr311-api-${jsr311-api.version}.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry>
@@ -29,371 +28,280 @@
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry>
<AuxClasspathEntry>/home/dave/dev/fb-contrib/lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry>
</Project>
- <BugInstance type="IMC_IMMATURE_CLASS_NO_PACKAGE" priority="3" rank="20" abbrev="IMC" category="STYLE" instanceHash="52beb96b508e41498d672e105e62ceda" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
- <ShortMessage>Class is defined in the default package</ShortMessage>
- <LongMessage>Class A id defined in the default package</LongMessage>
- <Class classname="A" primary="true">
- <SourceLine classname="A" start="1" end="1" sourcefile="SCR_Sample.java" sourcepath="SCR_Sample.java">
- <Message>At SCR_Sample.java:[line 1]</Message>
- </SourceLine>
- <Message>In class A</Message>
- </Class>
- <SourceLine classname="A" start="1" end="1" sourcefile="SCR_Sample.java" sourcepath="SCR_Sample.java" synthetic="true">
- <Message>At SCR_Sample.java:[line 1]</Message>
- </SourceLine>
- </BugInstance>
- <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="5421bf96fc5a9d37844eb8b32cd4cb17" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
+ <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="c119924fdc9852642c13941116e4133a" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
<ShortMessage>Method uses array as basis of collection</ShortMessage>
- <LongMessage>Method ABC_Sample.testLists(List, String[]) uses array as basis of collection</LongMessage>
- <Class classname="ABC_Sample" primary="true">
- <SourceLine classname="ABC_Sample" start="9" end="23" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java">
- <Message>At ABC_Sample.java:[lines 9-23]</Message>
+ <LongMessage>Method ex.ABC_Sample.testLists(List, String[]) uses array as basis of collection</LongMessage>
+ <Class classname="ex.ABC_Sample" primary="true">
+ <SourceLine classname="ex.ABC_Sample" start="10" end="24" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java">
+ <Message>At ABC_Sample.java:[lines 10-24]</Message>
</SourceLine>
- <Message>In class ABC_Sample</Message>
+ <Message>In class ex.ABC_Sample</Message>
</Class>
- <Method classname="ABC_Sample" name="testLists" signature="(Ljava/util/List;[Ljava/lang/String;)Z" isStatic="false" primary="true">
- <SourceLine classname="ABC_Sample" start="23" end="23" startBytecode="0" endBytecode="87" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java"/>
- <Message>In method ABC_Sample.testLists(List, String[])</Message>
+ <Method classname="ex.ABC_Sample" name="testLists" signature="(Ljava/util/List;[Ljava/lang/String;)Z" isStatic="false" primary="true">
+ <SourceLine classname="ex.ABC_Sample" start="24" end="24" startBytecode="0" endBytecode="87" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java"/>
+ <Message>In method ex.ABC_Sample.testLists(List, String[])</Message>
</Method>
- <SourceLine classname="ABC_Sample" primary="true" start="23" end="23" startBytecode="2" endBytecode="2" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java">
- <Message>At ABC_Sample.java:[line 23]</Message>
+ <SourceLine classname="ex.ABC_Sample" primary="true" start="24" end="24" startBytecode="2" endBytecode="2" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java">
+ <Message>At ABC_Sample.java:[line 24]</Message>
</SourceLine>
</BugInstance>
- <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="40414f9e8176322dc38b05fd7a40112b" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
+ <BugInstance type="ABC_ARRAY_BASED_COLLECTIONS" priority="2" rank="7" abbrev="ABC" category="CORRECTNESS" instanceHash="5022f7e5f22e85b8c09eb0698effc480" instanceOccurrenceNum="0" instanceOccurrenceMax="0">
<ShortMessage>Method uses array as basis of collection</ShortMessage>
- <LongMessage>Method ABC_Sample.testMaps(String[], String) uses array as basis of collection</LongMessage>
- <Class classname="ABC_Sample" primary="true">
- <SourceLine classname="ABC_Sample" start="9" end="23" sourcefile="ABC_Sample.java" sourcepath="ABC_Sample.java">
- <Message>At ABC_Sample.java:[lines 9-23]</Message>
+ <LongMessage>Method ex.ABC_Sample.testMaps(String[], String) uses array as basis of collection</LongMessage>
+ <Class classname="ex.ABC_Sample" primary="true">
+ <SourceLine classname="ex.ABC_Sample" start="10" end="24" sourcefile="ABC_Sample.java" sourcepath="ex/ABC_Sample.java">
+ <Message>At ABC_Sample.java:[lines 10-24]</Message>
</SourceLine>
- <Message>In class ABC_Sample</Message>
+ <Message>In class ex.ABC_Sample</Me...
[truncated message content] |
|
From: <dbr...@us...> - 2017-04-14 23:56:40
|
Revision: 1817
http://sourceforge.net/p/fb-contrib/code/1817
Author: dbrosius
Date: 2017-04-14 23:56:37 +0000 (Fri, 14 Apr 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bugrank.txt
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
trunk/fb-contrib/src/samples/java/ex/IMC_Sample.java
trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java
Added Paths:
-----------
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java
trunk/fb-contrib/src/samples/java/ex/UAC_Sample.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/build.xml 2017-04-14 23:56:37 UTC (rev 1817)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="6.9.0-SNAPSHOT" />
+ <property name="fb-contrib.version" value="7.0.0" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/etc/bugrank.txt 2017-04-14 23:56:37 UTC (rev 1817)
@@ -69,8 +69,10 @@
+0 BugPattern IMC_IMMATURE_CLASS_NO_PACKAGE
+2 BugPattern IMC_IMMATURE_CLASS_NO_TOSTRING
+0 BugPattern IMC_IMMATURE_CLASS_PRINTSTACKTRACE
++0 BugPattern IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER
+0 BugPattern IOI_COPY_WITH_READER
+0 BugPattern IOI_DOUBLE_BUFFER_COPY
++0 BugPattern IOI_USE_OF_FILE_STREAM_CONSTRUCTORS
+0 BugPattern IPU_IMPROPER_PROPERTIES_USE
+0 BugPattern IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY
+0 BugPattern ISB_EMPTY_STRING_APPENDING
@@ -232,6 +234,8 @@
+0 BugPattern TBP_TRISTATE_BOOLEAN_PATTERN
+0 BugPattern TR_TAIL_RECURSION
+0 BugPattern UAA_USE_ADD_ALL
++0 BugPattern UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT
++0 BugPattern UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH
+0 BugPattern UCC_UNRELATED_COLLECTION_CONTENTS
+0 BugPattern UCPM_USE_CHARACTER_PARAMETERIZED_METHOD
+0 BugPattern UEC_USE_ENUM_COLLECTIONS
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-04-14 23:56:37 UTC (rev 1817)
@@ -20,7 +20,7 @@
<!-- Detectors -->
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
@@ -30,7 +30,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
@@ -77,7 +77,7 @@
<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.UnnecessaryStoreBeforeReturn" speed="fast" reports="USBR_UNNECESSARY_STORE_BEFORE_RETURN,UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod" speed="fast" reports="COM_COPIED_OVERRIDDEN_METHOD,COM_PARENT_DELEGATED_CALL" />
@@ -285,7 +285,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.StringifiedTypes" speed="fast" reports="STT_STRING_PARSING_A_FIELD,STT_TOSTRING_STORED_IN_FIELD" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.ImmatureClass" speed="moderate" reports="IMC_IMMATURE_CLASS_NO_EQUALS,IMC_IMMATURE_CLASS_NO_HASHCODE,IMC_IMMATURE_CLASS_NO_PACKAGE,IMC_IMMATURE_CLASS_NO_TOSTRING,IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES,IMC_IMMATURE_CLASS_PRINTSTACKTRACE" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ImmatureClass" speed="moderate" reports="IMC_IMMATURE_CLASS_NO_EQUALS,IMC_IMMATURE_CLASS_NO_HASHCODE,IMC_IMMATURE_CLASS_NO_PACKAGE,IMC_IMMATURE_CLASS_NO_TOSTRING,IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES,IMC_IMMATURE_CLASS_PRINTSTACKTRACE,IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.JAXRSIssues" speed="fast" reports="JXI_GET_ENDPOINT_CONSUMES_CONTENT,JXI_INVALID_CONTEXT_PARAMETER_TYPE,JXI_PARM_PARAM_NOT_FOUND_IN_PATH,JXI_UNDEFINED_PARAMETER_SOURCE_IN_ENDPOINT" />
@@ -295,7 +295,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuboptimalExpressionOrder" speed="fast" reports="SEO_SUBOPTIMAL_EXPRESSION_ORDER"/>
- <Detector class="com.mebigfatguy.fbcontrib.detect.IOIssues" speed="fast" reports="IOI_DOUBLE_BUFFER_COPY,IOI_COPY_WITH_READER"/>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.IOIssues" speed="fast" reports="IOI_DOUBLE_BUFFER_COPY,IOI_COPY_WITH_READER,IOI_USE_OF_FILE_STREAM_CONSTRUCTORS"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.DubiousMapCollection" speed="fast" reports="DMC_DUBIOUS_MAP_COLLECTION"/>
@@ -305,10 +305,6 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues" speed="fast" reports="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY"/>
- <!-- COMMENT OUT FOR POINT RELEASE -->
-
- <Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/>
-
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousShadedClassUse" speed="fast" reports="SSCU_SUSPICIOUS_SHADED_CLASS_USE"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.UnsynchronizedSingletonFieldWrites" speed="fast" reports="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES"/>
@@ -315,8 +311,14 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED"/>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT"/>
+
<!-- COMMENT OUT FOR POINT RELEASE -->
+ <Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/>
+
+ <!-- COMMENT OUT FOR POINT RELEASE -->
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -567,6 +569,7 @@
<BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_NO_PACKAGE" category="STYLE" />
<BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_NO_TOSTRING" category="STYLE" />
<BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_PRINTSTACKTRACE" category="STYLE" />
+ <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER" category="STYLE" />
<BugPattern abbrev="JXI" type="JXI_GET_ENDPOINT_CONSUMES_CONTENT" category="CORRECTNESS" />
<BugPattern abbrev="JXI" type="JXI_INVALID_CONTEXT_PARAMETER_TYPE" category="CORRECTNESS" />
<BugPattern abbrev="JXI" type="JXI_PARM_PARAM_NOT_FOUND_IN_PATH" category="CORRECTNESS" />
@@ -581,6 +584,7 @@
<BugPattern abbrev="SEO" type="SEO_SUBOPTIMAL_EXPRESSION_ORDER" category="PERFORMANCE"/>
<BugPattern abbrev="IOI" type="IOI_DOUBLE_BUFFER_COPY" category="PERFORMANCE"/>
<BugPattern abbrev="IOI" type="IOI_COPY_WITH_READER" category="PERFORMANCE"/>
+ <BugPattern abbrev="IOI" type="IOI_USE_OF_FILE_STREAM_CONSTRUCTORS"/>
<BugPattern abbrev="DMC" type="DMC_DUBIOUS_MAP_COLLECTION" category="CORRECTNESS"/>
<BugPattern abbrev="BL" type="BL_BURYING_LOGIC" category="STYLE"/>
<BugPattern abbrev="WI" type="WI_DUPLICATE_WIRED_TYPES" category="CORRECTNESS"/>
@@ -592,4 +596,6 @@
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION" category="CORRECTNESS" experimental="true"/>
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_CHECKING_REFERENCE" category="CORRECTNESS" experimental="true"/>
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED" category="CORRECTNESS" experimental="true"/>
+ <BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT" category="CORRECTNESS" experimental="true"/>
+ <BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" category="CORRECTNESS" experimental="true"/>
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/etc/messages.xml 2017-04-14 23:56:37 UTC (rev 1817)
@@ -1685,7 +1685,18 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion">
+ <Details>
+ <![CDATA[
+ <p>Looks for code that appears to be using two forms of similar apis, an older one, and a new one.
+ It finds code that creates newer api objects by first instantiating older api objects, and converting
+ them into the new form. It is simpler just to create the new object directly.</p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger">
<Details></Details>
</Detector>
@@ -5415,6 +5426,20 @@
</Details>
</BugPattern>
+ <BugPattern type="IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER">
+ <ShortDescription>Class orders instance fields before static fields</ShortDescription>
+ <LongDescription>Class {0} orders instance fields before static fields</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This class adds fields to the class in an order that is confusing, and not expected by
+ other developers. The standard is for static fields to be listed first, followed by instance
+ fields. when fields are listed out of order, developers may make assumptions about their
+ behaviour that is incorrect and lead to bugs.</p>
+ ]]>
+ </Details>
+ </BugPattern>
+
+
<BugPattern type="JXI_GET_ENDPOINT_CONSUMES_CONTENT">
<ShortDescription>JAX-RS Method implements a GET request but consumes input</ShortDescription>
<LongDescription>JAX-RS Method {1} implements a GET request but consumes input</LongDescription>
@@ -5617,6 +5642,26 @@
</Details>
</BugPattern>
+ <BugPattern type="IOI_USE_OF_FILE_STREAM_CONSTRUCTORS">
+ <ShortDescription>Method uses a FileInputStream or FileOutputStream constructor</ShortDescription>
+ <LongDescription>Method {1} uses a FileInputStream or FileOutputStream constructor</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method creates and uses a java.io.FileInputStream or java.io.FileOutputStream object. Unfortunately both
+ of these classes implement a finalize method, which means that objects created will likely hang around until a
+ full garbage collection occurs, which will leave excessive garbage on the heap for longer, and potentially much
+ longer than expected. Java 7 introduced two ways to create streams for reading and writing files that do not have this concern.
+ You should consider switching from these above classes to
+ <code>
+ InputStream is = java.nio.file.Files.newInputStream(myfile.toPath());
+ OutputStream os = java.nio.file.Files.newOutputStream(myfile.toPath());
+ </code>
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+
+
<BugPattern type="DMC_DUBIOUS_MAP_COLLECTION">
<ShortDescription>Class holds a map-type field, but uses it as only a List</ShortDescription>
<LongDescription>Class {0} holds a map-type field {1}, but uses it as only a List</LongDescription>
@@ -5772,6 +5817,32 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT">
+ <ShortDescription>Method constructs a Date object, merely to convert it to an Instant object</ShortDescription>
+ <LongDescription>Method {1} constructs a Date object, merely to convert it to an Instant object</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method creates a java.time.Instant object by first creating a java.util.Date object, and then calling
+ toInstant() on it. It is simpler to just construct the Instant object directly, say by using
+ {@code Instant.now()} to get the current time, of by using {@code Instant.parse(CharSequence)} to convert a String.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+
+ <BugPattern type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH">
+ <ShortDescription>Method constructs a File object, merely to convert it to a Path object</ShortDescription>
+ <LongDescription>Method {1} constructs a File object, merely to convert it to a Path object</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method creates a java.nio.file.Path object by first creating a java.io.File object, and then calling
+ toPath() on it. It is simpler to just construct the Path object directly, say by using
+ {@code Path.get(String...)}.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
<!-- BugCode -->
@@ -5914,4 +5985,5 @@
<BugCode abbrev="SSCU">Suspicious Shaded Class Use</BugCode>
<BugCode abbrev="USFW">Unsynchronized Singleton Field Writes</BugCode>
<BugCode abbrev="OI">Optional Issues</BugCode>
+ <BugCode abbrev="UAC">Unnecessary Api Conversion</BugCode>
</MessageCollection>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/htdocs/index.shtml 2017-04-14 23:56:37 UTC (rev 1817)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 6.8.4 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.0 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
@@ -77,13 +77,20 @@
</div>
<hr/>
- <img id="git_image" src="flip2.gif" onClick="toggleBlock('git', 'git_image');" align="top"/>
+ <img id="git_image" src="flip1.gif" onClick="toggleBlock('git', 'git_image');" align="top"/>
Detectors added in git<br/>
- <div id="git" style="display:block;">
- <ul>
+ <div id="git" style="display:none;">
+ <ul>
<li><b>[UTWR] Use Try With Resources</b><br/>
Looks for try/finally blocks that manage resources, without using try-with-resources.
</li>
+ </ul>
+ </div>
+ <hr/>
+ <img id="v7_0_0_image" src="flip2.gif" onClick="toggleBlock('v7_0_0', 'v7_0_0_image');" align="top"/>
+ Detectors added in v7.0.0<br/>
+ <div id="v7_0_0" style="display:block;">
+ <ul>
<li><b>[SSCU] Suspicious Shaded Class Use</b><br/>
Looks for use of classes that have been shaded into 3rdparty jars, rather than using the
real class, from the real jar.
@@ -94,6 +101,11 @@
<li><b>[OI] Optional Issues</b><br/>
Looks for various issues around use of java.util.Optional
</li>
+ <li><b>[UAC] Unnecessary Api Conversion</b><br/>
+ Looks for code that appears to be using two forms of similar apis, an older one, and a new one.
+ It finds code that creates newer api objects by first instantiating older api objects, and converting
+ them into the new form. It is simpler just to create the new object directly.
+ </li>
</ul>
</div>
<hr/>
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/htdocs/repository.html 2017-04-14 23:56:37 UTC (rev 1817)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>6.8.4</td></tr>
+ <tr><td><b>Version:</b></td><td>7.0.0</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/pom.xml 2017-04-14 23:56:37 UTC (rev 1817)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>6.9.0-SNAPSHOT</version>
+ <version>7.0.0</version>
<prerequisites>
<maven>2.2.1</maven>
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java 2017-04-14 23:56:37 UTC (rev 1817)
@@ -20,6 +20,7 @@
import java.util.Set;
+import org.apache.bcel.Constants;
import org.apache.bcel.Repository;
import org.apache.bcel.classfile.Code;
import org.apache.bcel.classfile.JavaClass;
@@ -73,6 +74,7 @@
private BugReporter bugReporter;
private OpcodeStack stack;
+ private int clsVersion;
/**
* constructs a IOI detector given the reporter to report bugs on
@@ -102,6 +104,7 @@
try {
stack = new OpcodeStack();
+ clsVersion = clsContext.getJavaClass().getMajor();
super.visitClassContext(clsContext);
} finally {
stack = null;
@@ -124,7 +127,8 @@
/**
* implements the visitor to look for common api copy utilities to copy streams where the passed in Stream is Buffered. Since these libraries already handle
* the buffering, you are just slowing them down by the extra copy. Also look for copies where the source is a Reader, as this is just wasteful. Can't wrap
- * my head around whether a Writer output is sometime valid, might be, so for now ignoring that.
+ * my head around whether a Writer output is sometime valid, might be, so for now ignoring that. Also reports uses of java.io.FileInputStream and
+ * java.io.FileOutputStream on {@code java >= 1.7} as those classes have finalize methods that junk up gc.
*
* @param seen
* the currently parsed opcode
@@ -164,6 +168,11 @@
String clsName = getDottedClassConstantOperand();
if (BUFFERED_CLASSES.contains(clsName)) {
return IOIUserValue.BUFFER;
+ } else if ("java.io.FileInputStream".equals(clsName) || "java.io.FileOutputStream".equals(clsName)) {
+ if (clsVersion >= Constants.MAJOR_1_7) {
+ bugReporter.reportBug(new BugInstance(this, BugType.IOI_USE_OF_FILE_STREAM_CONSTRUCTORS.name(), NORMAL_PRIORITY).addClass(this)
+ .addMethod(this).addSourceLine(this));
+ }
} else if (readerClass != null) {
JavaClass cls = Repository.lookupClass(clsName);
if (cls.instanceOf(readerClass)) {
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java 2017-04-14 23:56:37 UTC (rev 1817)
@@ -36,7 +36,12 @@
NOT_NEEDED, UNKNOWN, NEEDED
};
+ enum FieldStatus {
+ NONE, SAW_INSTANCE, REPORTED
+ }
+
private BugReporter bugReporter;
+ private FieldStatus fieldStatus = FieldStatus.NONE;
public ImmatureClass(BugReporter reporter) {
bugReporter = reporter;
@@ -51,6 +56,7 @@
@Override
public void visitClassContext(ClassContext classContext) {
JavaClass cls = classContext.getJavaClass();
+ fieldStatus = FieldStatus.NONE;
if (cls.getPackageName().isEmpty()) {
bugReporter.reportBug(new BugInstance(this, BugType.IMC_IMMATURE_CLASS_NO_PACKAGE.name(), LOW_PRIORITY).addClass(cls));
@@ -112,6 +118,30 @@
super.visitClassContext(classContext);
}
+ @Override
+ public void visitField(Field f) {
+ if (!f.isSynthetic() && !f.getName().contains("$")) {
+ switch (fieldStatus) {
+ case NONE:
+ if (!f.isStatic()) {
+ fieldStatus = FieldStatus.SAW_INSTANCE;
+ }
+ break;
+
+ case SAW_INSTANCE:
+ if (f.isStatic()) {
+ bugReporter.reportBug(
+ new BugInstance(this, BugType.IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER.name(), LOW_PRIORITY).addClass(this).addField(this));
+ fieldStatus = FieldStatus.REPORTED;
+ }
+ break;
+
+ case REPORTED:
+ break;
+ }
+ }
+ }
+
/**
* implements the visitor to check for calls to Throwable.printStackTrace()
*
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2017-04-14 23:56:37 UTC (rev 1817)
@@ -20,8 +20,6 @@
import java.util.BitSet;
import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
import java.util.Set;
import org.apache.bcel.Constants;
@@ -131,22 +129,6 @@
}
/**
- * removes all methods from the map that are synthetic
- *
- * @param methods
- * the methods to check
- */
- private void removeSyntheticMethods(Map<QMethod, Boolean> methods) {
- Iterator<Map.Entry<QMethod, Boolean>> it = methods.entrySet().iterator();
- while (it.hasNext()) {
- Map.Entry<QMethod, Boolean> entry = it.next();
- if (entry.getValue().booleanValue()) {
- it.remove();
- }
- }
- }
-
- /**
* builds a set of all non constructor or static initializer method/signatures
*
* @param cls
Added: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java (rev 0)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java 2017-04-14 23:56:37 UTC (rev 1817)
@@ -0,0 +1,108 @@
+/*
+ * fb-contrib - Auxiliary detectors for Java programs
+ * Copyright (C) 2005-2017 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.Map;
+
+import org.apache.bcel.classfile.Code;
+
+import com.mebigfatguy.fbcontrib.utils.BugType;
+import com.mebigfatguy.fbcontrib.utils.FQMethod;
+
+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.XMethod;
+
+/**
+ * looks for code that appears to be using two forms of similar apis, an older one, and a new one. It finds code that creates newer api objects by first
+ * instantiating older api objects, and converting them into the new form. It is simpler just to create the new object directly.
+ */
+public class UnnecessaryApiConversion extends BytecodeScanningDetector {
+
+ private static Map<FQMethod, LegacyInfo> conversions = new HashMap<>();
+
+ static {
+ conversions.put(new FQMethod("java/util/Date", "toInstant", "()Ljava/time/Instant;"),
+ new LegacyInfo("<init>", BugType.UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT));
+ conversions.put(new FQMethod("java/io/File", "toPath", "()Ljava/nio/file/Path;"),
+ new LegacyInfo("<init>", BugType.UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH));
+
+ }
+
+ private BugReporter bugReporter;
+ private OpcodeStack stack;
+
+ public UnnecessaryApiConversion(BugReporter bugReporter) {
+ this.bugReporter = bugReporter;
+ }
+
+ @Override
+ public void visitClassContext(ClassContext classContext) {
+ try {
+ stack = new OpcodeStack();
+ super.visitClassContext(classContext);
+ } finally {
+ stack = null;
+ }
+ }
+
+ @Override
+ public void visitCode(Code obj) {
+ stack.resetForMethodEntry(this);
+ super.visitCode(obj);
+ }
+
+ @Override
+ public void sawOpcode(int seen) {
+
+ try {
+ switch (seen) {
+ case INVOKEVIRTUAL:
+ FQMethod conversionMethod = new FQMethod(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand());
+ LegacyInfo legacyInfo = conversions.get(conversionMethod);
+ if ((legacyInfo != null) && (stack.getStackDepth() > 0)) {
+ OpcodeStack.Item itm = stack.getStackItem(0);
+ XMethod xm = itm.getReturnValueOf();
+ if ((xm != null) && (xm.getName().equals(legacyInfo.methodName)
+ && (xm.getClassName().equals(conversionMethod.getClassName().replace('/', '.'))))) {
+ bugReporter.reportBug(
+ new BugInstance(this, legacyInfo.bugType.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this));
+ }
+ }
+ break;
+ }
+ } finally {
+ stack.sawOpcode(this, seen);
+ }
+ }
+
+ static class LegacyInfo {
+ String methodName;
+ BugType bugType;
+
+ public LegacyInfo(String methodName, BugType bugType) {
+ this.methodName = methodName;
+ this.bugType = bugType;
+ }
+ }
+}
Property changes on: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java 2017-04-09 22:42:29 UTC (rev 1816)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java 2017-04-14 23:56:37 UTC (rev 1817)
@@ -100,8 +100,10 @@
IMC_IMMATURE_CLASS_NO_PACKAGE,
IMC_IMMATURE_CLASS_NO_TOSTRING,
IMC_IMMATURE_CLASS_PRINTSTACKTRACE,
+ IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER,
IOI_COPY_WITH_READER,
IOI_DOUBLE_BUFFER_COPY,
+ IOI_USE_OF_FILE_STREAM_CONSTRUCTORS,
IPU_IMPROPER_PROPERTIES_USE,
IPU_IMPROPER_PROPERTIES_USE_SETPROPERTY,
ISB_EMPTY_STRING_APPENDING,
@@ -272,6 +274,8 @@
TR_TAIL_RECURSION,
UAA_USE_ADD_ALL,
+ UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT,
+ UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH,
UCC_UNRELATED_COLLECTION_CONTENTS,
UCPM_USE_CHARACTER_PARAMETERIZED_METHOD,
UEC_US...
[truncated message content] |
|
From: <dbr...@us...> - 2017-04-22 21:22:21
|
Revision: 1819
http://sourceforge.net/p/fb-contrib/code/1819
Author: dbrosius
Date: 2017-04-22 21:22:18 +0000 (Sat, 22 Apr 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java
trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/build.xml 2017-04-22 21:22:18 UTC (rev 1819)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.0.0" />
+ <property name="fb-contrib.version" value="7.0.1" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-04-22 21:22:18 UTC (rev 1819)
@@ -30,7 +30,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
@@ -313,11 +313,11 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT"/>
- <!-- COMMENT OUT FOR POINT RELEASE -->
+ <!-- COMMENT OUT FOR POINT RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/>
- <!-- COMMENT OUT FOR POINT RELEASE -->
+ COMMENT OUT FOR POINT RELEASE -->
<!-- BugPattern -->
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/htdocs/index.shtml 2017-04-22 21:22:18 UTC (rev 1819)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.0 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.1 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/htdocs/repository.html 2017-04-22 21:22:18 UTC (rev 1819)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.0.0</td></tr>
+ <tr><td><b>Version:</b></td><td>7.0.1</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/pom.xml 2017-04-22 21:22:18 UTC (rev 1819)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.0.0</version>
+ <version>7.0.1</version>
<prerequisites>
<maven>2.2.1</maven>
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2017-04-22 21:22:18 UTC (rev 1819)
@@ -45,8 +45,9 @@
* variables, and not member variables, or this.
*/
public class BloatedSynchronizedBlock extends BytecodeScanningDetector {
+ private static final String BSB_MIN_SAFE_CODE_SIZE = "fb-contrib.bsb.minsize";
+
private final BugReporter bugReporter;
- private static final String BSB_MIN_SAFE_CODE_SIZE = "fb-contrib.bsb.minsize";
private OpcodeStack stack;
private BitSet unsafeAliases;
private Map<Integer, Integer> branchInfo;
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java 2017-04-22 21:22:18 UTC (rev 1819)
@@ -233,6 +233,9 @@
return removedClass;
}
+ /**
+ * finds class dependency loops in a directed graph
+ */
static class LoopFinder {
private Map<String, Set<String>> dGraph = null;
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java 2017-04-22 21:22:18 UTC (rev 1819)
@@ -170,6 +170,16 @@
return IOIUserValue.BUFFER;
} else if ("java.io.FileInputStream".equals(clsName) || "java.io.FileOutputStream".equals(clsName)) {
if (clsVersion >= Constants.MAJOR_1_7) {
+ if (!getMethod().isStatic()) {
+ String sig = getSigConstantOperand();
+ int numParms = SignatureUtils.getNumParameters(sig);
+ if (stack.getStackDepth() > numParms) {
+ OpcodeStack.Item itm = stack.getStackItem(numParms);
+ if (itm.getRegisterNumber() == 0) {
+ return null;
+ }
+ }
+ }
bugReporter.reportBug(new BugInstance(this, BugType.IOI_USE_OF_FILE_STREAM_CONSTRUCTORS.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addSourceLine(this));
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2017-04-22 21:22:18 UTC (rev 1819)
@@ -38,7 +38,6 @@
* 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;
private static final Set<String> internalPackages = UnmodifiableSet.create(
// @formatter:off
@@ -77,6 +76,8 @@
// @formatter:on
);
+ private final BugReporter bugReporter;
+
/**
* constructs a IICU detector given the reporter to report bugs on
*
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2017-04-22 21:22:18 UTC (rev 1819)
@@ -50,7 +50,7 @@
@CustomUserValue
public class OptionalIssues extends BytecodeScanningDetector {
- private Set<String> BOXED_OPTIONAL_TYPES = UnmodifiableSet.create("Ljava/lang/Integer;", "Ljava/lang/Long;", "Ljava/lang/Double;");
+ private static Set<String> BOXED_OPTIONAL_TYPES = UnmodifiableSet.create("Ljava/lang/Integer;", "Ljava/lang/Long;", "Ljava/lang/Double;");
private static final FQMethod OPTIONAL_OR_ELSE_METHOD = new FQMethod("java/util/Optional", "orElse", "(Ljava/lang/Object;)Ljava/lang/Object;");
private static final FQMethod OPTIONAL_OR_ELSE_GET_METHOD = new FQMethod("java/util/Optional", "orElseGet",
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java 2017-04-22 21:22:18 UTC (rev 1819)
@@ -42,7 +42,6 @@
* code, and not propagated.
*/
public class RuntimeExceptionDeclared extends PreorderVisitor implements Detector {
- private final BugReporter bugReporter;
private static JavaClass runtimeExceptionClass;
static {
@@ -53,6 +52,7 @@
}
}
+ private final BugReporter bugReporter;
private final Set<String> runtimeExceptions = new HashSet<>();
/**
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java 2017-04-22 21:22:18 UTC (rev 1819)
@@ -46,7 +46,6 @@
* unsafe. When iterators are to be used, synchronization should be done manually.
*/
public class SyncCollectionIterators extends BytecodeScanningDetector {
- private final BugReporter bugReporter;
private static final Set<String> synchCollectionNames = UnmodifiableSet.create("synchronizedSet", "synchronizedMap", "synchronizedList",
"synchronizedSortedSet", "synchronizedSortedMap");
@@ -56,6 +55,7 @@
SEEN_NOTHING, SEEN_SYNC, SEEN_LOAD
}
+ private final BugReporter bugReporter;
private State state;
private Set<String> memberCollections;
private BitSet localCollections;
Modified: trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java 2017-04-15 00:00:24 UTC (rev 1818)
+++ trunk/fb-contrib/src/samples/java/ex/IOI_Sample.java 2017-04-22 21:22:18 UTC (rev 1819)
@@ -44,4 +44,12 @@
}
}
}
+
+ class FPBofoStream extends FileInputStream {
+
+ public FPBofoStream(File f) throws IOException {
+ super(f);
+ }
+
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2017-05-29 20:49:50
|
Revision: 1821
http://sourceforge.net/p/fb-contrib/code/1821
Author: dbrosius
Date: 2017-05-29 20:49:46 +0000 (Mon, 29 May 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bugrank.txt
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/findbugsplugin.xsd
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/debug/Debug.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StringifiedTypes.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseTryWithResources.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilder.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/Values.java
trunk/fb-contrib/src/samples/java/ex/IMC_Sample.java
trunk/fb-contrib/src/samples/java/ex/PCAIL_Sample.java
trunk/fb-contrib/src/samples/java/ex/PRMC_Sample.java
trunk/fb-contrib/src/samples/java/ex/SPP_Sample.java
trunk/fb-contrib/src/samples/java/ex/STT_Sample.java
trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureUtilsTest.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/.classpath 2017-05-29 20:49:46 UTC (rev 1821)
@@ -17,7 +17,7 @@
</classpathentry>
<classpathentry kind="lib" path="lib/findbugs-3.0.1.jar" sourcepath="lib/sources/findbugs-3.0.1-sources.jar"/>
<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
- <classpathentry kind="lib" path="lib/javax.persistence-2.1.1.jar"/>
+ <classpathentry kind="lib" path="lib/javax.persistence-2.1.1.jar" sourcepath="/home/dave/.m2/repository/org/eclipse/persistence/javax.persistence/2.1.1/javax.persistence-2.1.1-sources.jar"/>
<classpathentry kind="lib" path="lib/mockito-all-2.0.2-beta.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
<classpathentry kind="lib" path="lib/threetenbp-1.3.2.jar"/>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/build.xml 2017-05-29 20:49:46 UTC (rev 1821)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.0.1" />
+ <property name="fb-contrib.version" value="7.0.2" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/etc/bugrank.txt 2017-05-29 20:49:46 UTC (rev 1821)
@@ -228,6 +228,7 @@
+0 BugPattern STB_STACKED_TRY_BLOCKS
+2 BugPattern STS_SPURIOUS_THREAD_STATES
+0 BugPattern STT_STRING_PARSING_A_FIELD
++0 BugPattern STT_TOSTRING_MAP_KEYING
+0 BugPattern STT_TOSTRING_STORED_IN_FIELD
+0 BugPattern SUA_SUSPICIOUS_UNINITIALIZED_ARRAY
+0 BugPattern SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT
@@ -249,27 +250,27 @@
+0 BugPattern USBR_UNNECESSARY_STORE_BEFORE_RETURN
+0 BugPattern USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES
+0 BugPattern USS_USE_STRING_SPLIT
-+0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT
-+0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_ASSERT_USED
-+0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT
-+0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL
-+0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE
-+2 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_NO_ASSERT
-+0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_EQUALS
-+0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NOT_EQUALS
-+0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL
-+0 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NULL
++3 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT
++3 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_ASSERT_USED
++3 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT
++3 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL
++3 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE
++1 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_NO_ASSERT
++3 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_EQUALS
++3 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NOT_EQUALS
++3 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL
++3 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_NULL
+1 BugPattern UTAO_JUNIT_ASSERTION_ODDITIES_USING_DEPRECATED
-+0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_ACTUAL_CONSTANT
-+0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_ASSERT_USED
-+0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_BOOLEAN_ASSERT
-+0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_IMPOSSIBLE_NULL
-+0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_INEXACT_DOUBLE
-+2 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_NO_ASSERT
-+0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_EQUALS
-+0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NOT_EQUALS
-+0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL
-+0 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NULL
++3 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_ACTUAL_CONSTANT
++3 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_ASSERT_USED
++3 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_BOOLEAN_ASSERT
++3 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_IMPOSSIBLE_NULL
++3 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_INEXACT_DOUBLE
++1 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_NO_ASSERT
++3 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_EQUALS
++3 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NOT_EQUALS
++3 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NOT_NULL
++3 BugPattern UTAO_TESTNG_ASSERTION_ODDITIES_USE_ASSERT_NULL
+0 BugPattern UTA_USE_TO_ARRAY
+0 BugPattern UTWR_USE_TRY_WITH_RESOURCES
+0 BugPattern UVA_USE_VAR_ARGS
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-05-29 20:49:46 UTC (rev 1821)
@@ -20,7 +20,7 @@
<!-- Detectors -->
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
@@ -30,7 +30,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
@@ -283,7 +283,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.OverlyPermissiveMethod" speed="fast" reports="OPM_OVERLY_PERMISSIVE_METHOD" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.StringifiedTypes" speed="fast" reports="STT_STRING_PARSING_A_FIELD,STT_TOSTRING_STORED_IN_FIELD" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.StringifiedTypes" speed="fast" reports="STT_STRING_PARSING_A_FIELD,STT_TOSTRING_STORED_IN_FIELD,STT_TOSTRING_MAP_KEYING" />
<Detector class="com.mebigfatguy.fbcontrib.detect.ImmatureClass" speed="moderate" reports="IMC_IMMATURE_CLASS_NO_EQUALS,IMC_IMMATURE_CLASS_NO_HASHCODE,IMC_IMMATURE_CLASS_NO_PACKAGE,IMC_IMMATURE_CLASS_NO_TOSTRING,IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES,IMC_IMMATURE_CLASS_PRINTSTACKTRACE,IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER" />
@@ -311,13 +311,13 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED"/>
- <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT"/>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT,UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"/>
<!-- COMMENT OUT FOR POINT RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/>
- COMMENT OUT FOR POINT RELEASE -->
+ COMMENT OUT FOR POINT RELEASE -->
<!-- BugPattern -->
@@ -561,6 +561,7 @@
<BugPattern abbrev="OPM" type="OPM_OVERLY_PERMISSIVE_METHOD" category="STYLE" />
<BugPattern abbrev="STT" type="STT_STRING_PARSING_A_FIELD" category="STYLE" />
<BugPattern abbrev="STT" type="STT_TOSTRING_STORED_IN_FIELD" category="STYLE" />
+ <BugPattern abbrev="STT" type="STT_TOSTRING_MAP_KEYING" category="STYLE" />
<BugPattern abbrev="SLS" type="SLS_SUSPICIOUS_LOOP_SEARCH" category="CORRECTNESS" />
<BugPattern abbrev="CRF" type="CRF_CONFLATING_RESOURCES_AND_FILES" category="CORRECTNESS" />
<BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES" category="STYLE" />
@@ -584,7 +585,7 @@
<BugPattern abbrev="SEO" type="SEO_SUBOPTIMAL_EXPRESSION_ORDER" category="PERFORMANCE"/>
<BugPattern abbrev="IOI" type="IOI_DOUBLE_BUFFER_COPY" category="PERFORMANCE"/>
<BugPattern abbrev="IOI" type="IOI_COPY_WITH_READER" category="PERFORMANCE"/>
- <BugPattern abbrev="IOI" type="IOI_USE_OF_FILE_STREAM_CONSTRUCTORS"/>
+ <BugPattern abbrev="IOI" type="IOI_USE_OF_FILE_STREAM_CONSTRUCTORS" category="PERFORMANCE"/>
<BugPattern abbrev="DMC" type="DMC_DUBIOUS_MAP_COLLECTION" category="CORRECTNESS"/>
<BugPattern abbrev="BL" type="BL_BURYING_LOGIC" category="STYLE"/>
<BugPattern abbrev="WI" type="WI_DUPLICATE_WIRED_TYPES" category="CORRECTNESS"/>
Modified: trunk/fb-contrib/etc/findbugsplugin.xsd
===================================================================
--- trunk/fb-contrib/etc/findbugsplugin.xsd 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/etc/findbugsplugin.xsd 2017-05-29 20:49:46 UTC (rev 1821)
@@ -22,7 +22,7 @@
<xsd:simpleType name="IdentifierType">
<xsd:restriction base="xsd:string">
- <xsd:pattern value="[A-Za-z0-9_]*"/>
+ <xsd:pattern value="[A-Za-z0-9_]+"/>
</xsd:restriction>
</xsd:simpleType>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/etc/messages.xml 2017-05-29 20:49:46 UTC (rev 1821)
@@ -5310,6 +5310,36 @@
</Details>
</BugPattern>
+ <BugPattern type="STT_TOSTRING_MAP_KEYING">
+ <ShortDescription>This method uses a concatenated String as a map key</ShortDescription>
+ <LongDescription>This method {1} uses a concatenated String as a map key</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method builds a key for a map, using a StringBuilder, either implicitly or explicitly. This means the type
+ of the key is something more t han a String constant, it is a properly formatted String. However, there is no
+ type based verification that all uses of this key will follow this formatting. It is much better to use a proper, simple,
+ bean class that holds two (or more fields) so that it is clear what is expected for key use.
+ </p>
+ <p>
+ Example<br/>
+ instead of
+ {@code
+ V v = myMap.get(tableName + "-" + columnName);
+ }
+ use
+ {@code
+ V v = myMap.get(new ColumnSpec(tableName, columnName));
+ }
+ where ColumnSpec is a simple bean-like class of your creation. The advantages, are
+ <ul>
+ <li>The ColumnSpec fully describes what is expected, you need a tableName and columnName</li>
+ <li>There is no guessing by the programmer what the format is, was it tableName + "_" + columnName?</li>
+ </ul>
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<BugPattern type="SLS_SUSPICIOUS_LOOP_SEARCH">
<ShortDescription>This method continues a loop after finding an equality condition</ShortDescription>
<LongDescription>This method {1} continues a loop after finding an equality condition</LongDescription>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/htdocs/index.shtml 2017-05-29 20:49:46 UTC (rev 1821)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.1 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.2 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/htdocs/repository.html 2017-05-29 20:49:46 UTC (rev 1821)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.0.1</td></tr>
+ <tr><td><b>Version:</b></td><td>7.0.2</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/pom.xml 2017-05-29 20:49:46 UTC (rev 1821)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.0.1</version>
+ <version>7.0.2</version>
<prerequisites>
<maven>2.2.1</maven>
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2017-05-29 20:49:46 UTC (rev 1821)
@@ -71,6 +71,8 @@
* @param bugReporter
* unused, but required by reflection contract
*/
+ // required for reflection
+ @SuppressWarnings("PMD.UnusedFormalParameter")
public CollectStatistics(BugReporter bugReporter) {
Statistics.getStatistics().clear();
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/debug/Debug.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/debug/Debug.java 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/debug/Debug.java 2017-05-29 20:49:46 UTC (rev 1821)
@@ -20,11 +20,12 @@
package com.mebigfatguy.fbcontrib.debug;
import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
public final class Debug {
@@ -33,7 +34,7 @@
static {
try {
out = new PrintStream(
- new BufferedOutputStream(new FileOutputStream(new File(System.getProperty("java.io.tmpdir"), "fb-contrib.txt").getPath(), true)), false,
+ new BufferedOutputStream(Files.newOutputStream(Paths.get(System.getProperty("java.io.tmpdir"), "fb-contrib.txt"), StandardOpenOption.APPEND)), false,
StandardCharsets.UTF_8.name());
out.println("===== fb-contrib console =====");
} catch (IOException e) {
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2017-05-29 20:49:46 UTC (rev 1821)
@@ -446,23 +446,24 @@
}
Comparable<?> groupElement = getGroupElement(itm);
- if (groupElement != null) {
- int numGroups = collectionGroups.size();
- for (int i = 0; i < numGroups; i++) {
- GroupPair groupPair = collectionGroups.get(i);
- if (groupPair.containsMember(groupElement)) {
- return i;
- }
+ if (groupElement == null) {
+ return -1;
+ }
+ int numGroups = collectionGroups.size();
+ for (int i = 0; i < numGroups; i++) {
+ GroupPair groupPair = collectionGroups.get(i);
+ if (groupPair.containsMember(groupElement)) {
+ return i;
}
+ }
- if (addIfNotFound) {
- GroupPair groupPair = new GroupPair(groupElement, itm.getSignature());
- collectionGroups.add(groupPair);
- return collectionGroups.size() - 1;
- }
+ if (!addIfNotFound) {
+ return -1;
}
- return -1;
+ GroupPair groupPair = new GroupPair(groupElement, itm.getSignature());
+ collectionGroups.add(groupPair);
+ return collectionGroups.size() - 1;
}
private void removeFromCollectionGroup(OpcodeStack.Item itm) {
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java 2017-05-29 20:49:46 UTC (rev 1821)
@@ -42,6 +42,7 @@
private BugReporter bugReporter;
private FieldStatus fieldStatus = FieldStatus.NONE;
+ private boolean classIsJPAEntity;
public ImmatureClass(BugReporter reporter) {
bugReporter = reporter;
@@ -66,6 +67,11 @@
try {
boolean clsHasRuntimeAnnotation = classHasRuntimeVisibleAnnotation(cls);
+ if (clsHasRuntimeAnnotation) {
+ classIsJPAEntity = classIsJPAEntity(cls);
+ } else {
+ classIsJPAEntity = false;
+ }
HEStatus heStatus = HEStatus.UNKNOWN;
checkIDEGeneratedParmNames(cls);
@@ -76,7 +82,7 @@
boolean fieldHasRuntimeAnnotation = fieldHasRuntimeVisibleAnnotation(f);
if (!fieldHasRuntimeAnnotation) {
/* only report one of these, so as not to flood the report */
- if (!hasMethodInHierarchy(cls, Values.TOSTRING, SignatureBuilder.SIG_VOID_TO_STRING)) {
+ if (!classIsJPAEntity && !hasMethodInHierarchy(cls, Values.TOSTRING, SignatureBuilder.SIG_VOID_TO_STRING)) {
bugReporter.reportBug(new BugInstance(this, BugType.IMC_IMMATURE_CLASS_NO_TOSTRING.name(), LOW_PRIORITY).addClass(cls));
heStatus = HEStatus.NOT_NEEDED;
break;
@@ -206,6 +212,26 @@
}
/**
+ * returns whether this class is a JPA Entity, as such it shouldn't really have a toString()
+ *
+ * @param cls
+ * the class to check
+ * @return if the class is a jpa entity
+ */
+ private static boolean classIsJPAEntity(JavaClass cls) {
+ AnnotationEntry[] annotations = cls.getAnnotationEntries();
+ if (annotations != null) {
+ for (AnnotationEntry annotation : annotations) {
+ if ("Ljavax/persistence/Entity;".equals(annotation.getAnnotationType())) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
* looks to see the field has a runtime visible annotation, if it does it might be autowired or some other mechanism attached that makes them less
* interesting for a toString call.
*
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2017-05-29 20:49:46 UTC (rev 1821)
@@ -261,6 +261,10 @@
if (invokeCount == 1) {
FQMethod method = activeStackOps.getLast().getMethod();
+ if (method == null) {
+ return false;
+ }
+
if ("valueOf".equals(method.getMethodName()) && method.getClassName().startsWith("java/lang/")) {
return true;
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java 2017-05-29 20:49:46 UTC (rev 1821)
@@ -376,7 +376,9 @@
}
}
} else {
- throw new RuntimeException("Incompatible bcel version");
+ throw new RuntimeException(
+ "Incompatible bcel version, apparently bcel has been upgraded to not use 'Unknown' for 'BootstrapMethods', but uses: "
+ + a.getName());
}
return null;
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2017-05-29 20:49:46 UTC (rev 1821)
@@ -62,6 +62,7 @@
private Map<Integer, Integer> storedAllocations;
private int nextAllocationNumber;
private List<SwitchInfo> switchInfos;
+ private int nextTernaryTarget;
public PossibleConstantAllocationInLoop(BugReporter bugReporter) {
this.bugReporter = bugReporter;
@@ -89,6 +90,7 @@
allocations.clear();
storedAllocations.clear();
nextAllocationNumber = 1;
+ nextTernaryTarget = -1;
super.visitCode(obj);
for (AllocationInfo info : allocations.values()) {
@@ -106,9 +108,30 @@
Integer sawAllocationNumber = null;
try {
+ if ((nextTernaryTarget == getPC()) && (stack.getStackDepth() > 0)) {
+ OpcodeStack.Item itm = stack.getStackItem(0);
+ sawAllocationNumber = (Integer) itm.getUserValue();
+ sawAllocation = sawAllocationNumber != null;
+ nextTernaryTarget = -1;
+ }
+
stack.precomputation(this);
+ if ((sawAllocation) && (stack.getStackDepth() > 0)) {
+ OpcodeStack.Item itm = stack.getStackItem(0);
+ itm.setUserValue(sawAllocationNumber);
+ sawAllocationNumber = null;
+ sawAllocation = false;
+ }
+
switch (seen) {
+ case GOTO:
+ case GOTO_W:
+ if ((getBranchOffset() > 0) && (stack.getStackDepth() > 0)) {
+ // ternary
+ nextTernaryTarget = getBranchTarget();
+ }
+ // $FALL-THROUGH$
case IFEQ:
case IFNE:
case IFLT:
@@ -125,8 +148,7 @@
case IF_ACMPNE:
case IFNULL:
case IFNONNULL:
- case GOTO:
- case GOTO_W:
+
processBranch();
break;
@@ -144,6 +166,7 @@
case INVOKEINTERFACE:
case INVOKEVIRTUAL:
case INVOKESTATIC:
+ case INVOKEDYNAMIC:
String signature = getSigConstantOperand();
int numParameters = SignatureUtils.getNumParameters(signature);
if (stack.getStackDepth() >= numParameters) {
@@ -154,7 +177,7 @@
allocations.remove(allocation);
}
}
- if (((seen == INVOKEINTERFACE) || (seen == INVOKEVIRTUAL) || (seen == INVOKESPECIAL))
+ if (((seen == INVOKEINTERFACE) || (seen == INVOKEVIRTUAL) || (seen == INVOKESPECIAL) || (seen == INVOKEDYNAMIC))
// ignore possible method chaining
&& (stack.getStackDepth() > numParameters)) {
OpcodeStack.Item item = stack.getStackItem(numParameters);
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2017-04-22 21:28:01 UTC (rev 1820)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2017-05-29 20:49:46 UTC (rev 1821)
@@ -34,9 +34,11 @@
import com.mebigfatguy.fbcontrib.collect.MethodInfo;
import com.mebigfatguy.fbcontrib.collect.Statistics;
import com.mebigfatguy.fbcontrib.utils.BugType;
+import com.mebigfatguy.fbcontrib.utils.FQMethod;
import com.mebigfatguy.fbcontrib.utils.RegisterUtils;
import com.mebigfatguy.fbcontrib.utils.SignatureUtils;
import com.mebigfatguy.fbcontrib.utils.ToString;
+import com.mebigfatguy.fbcontrib.utils.UnmodifiableSet;
import com.mebigfatguy.fbcontrib.utils.Values;
import edu.umd.cs.findbugs.BugInstance;
@@ -151,6 +153,27 @@
}
}
+ private static final Set<FQMethod> commonMethods = UnmodifiableSet.create(
+ // @formatter:off
+ new FQMethod("java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;"),
+ new FQMethod("java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;"),
+ new FQMethod("java/lang/Character", "valueOf", "(C)Ljava/lang/Character;"),
+ new FQMethod("java/lang/Short", "valueOf", "(S)Ljava/lang/Short;"),
+ new FQMethod("java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;"),
+ new FQMethod("java/lang/Long", "valueOf", "(J)Ljava/lang/Long;"),
+ new FQMethod("java/lang/Float", "valueOf", "(F)Ljava/lang/Float;"),
+ new FQMethod("java/lang/Double", "valueOf", "(D)Ljava/lang/Double;"),
+ new FQMethod("java/lang/Boolean", "booleanValue", "()Z"),
+ new FQMethod("java/lang/Byte", "byteValue", "()B"),
+ new FQMethod("java/lang/Character", "charValue", "()C"),
+ new FQMethod("java/lang/Short", "shortValue", "()S"),
+ new FQMethod("java/lang/Integer", "intValue", "()I"),
+ new FQMethod("java/lang/Long", "longValue", "()J"),
+ new FQMethod("java/lang/Float", "floatValue", "()F"),
+ new FQMethod("java/lang/Double", "doubleValue", "()D")
+ // @formatter:on
+ );
+
private final BugReporter bugReporter;
private OpcodeStack stack = null;
private Map<Integer, MethodCall> localMethodCalls = null;
@@ -347,7 +370,8 @@
if (mc != null) {
if (!signature.endsWith(Values.SIG_VOID) && methodName.equals(mc.getName()) && signature.equals(mc.getSignature())
- && !isRiskyName(className, methodName)) {
+ && !isRiskyName(className, methodName)
+ && !commonMethods.contains(new FQMethod(getClassConstantOperand()...
[truncated message content] |
|
From: <dbr...@us...> - 2017-07-19 21:29:50
|
Revision: 1823
http://sourceforge.net/p/fb-contrib/code/1823
Author: dbrosius
Date: 2017-07-19 21:29:47 +0000 (Wed, 19 Jul 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bugrank.txt
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/etc/samples.fbp
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InvalidConstantArgument.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/Values.java
trunk/fb-contrib/src/samples/java/ex/BED_Sample.java
trunk/fb-contrib/src/samples/java/ex/FCCD_Sample.java
trunk/fb-contrib/src/samples/java/ex/LO_Sample.java
trunk/fb-contrib/src/samples/java/ex/OPM_Sample.java
trunk/fb-contrib/src/samples/java/ex/UTAO_Sample.java
trunk/fb-contrib/yank.xls
Added Paths:
-----------
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java
trunk/fb-contrib/src/samples/java/ex/RFI_Sample.java
trunk/fb-contrib/src/samples/java/ex/opm/
trunk/fb-contrib/src/samples/java/ex/opm/RuleMatcher.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2017-05-29 20:54:00 UTC (rev 1822)
+++ trunk/fb-contrib/.classpath 2017-07-19 21:29:47 UTC (rev 1823)
@@ -18,8 +18,11 @@
<classpathentry kind="lib" path="lib/findbugs-3.0.1.jar" sourcepath="lib/sources/findbugs-3.0.1-sources.jar"/>
<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
<classpathentry kind="lib" path="lib/javax.persistence-2.1.1.jar" sourcepath="/home/dave/.m2/repository/org/eclipse/persistence/javax.persistence/2.1.1/javax.persistence-2.1.1-sources.jar"/>
- <classpathentry kind="lib" path="lib/mockito-all-2.0.2-beta.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/findbugs">
+ <accessrules>
+ <accessrule kind="nonaccessible" pattern="org/hamcrest/**"/>
+ </accessrules>
+ </classpathentry>
<classpathentry kind="lib" path="lib/threetenbp-1.3.2.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.10.jar"/>
<classpathentry kind="lib" path="lib/commons-collections-3.2.2.jar"/>
@@ -40,5 +43,7 @@
<classpathentry kind="lib" path="lib/commons-io-2.4.jar"/>
<classpathentry kind="lib" path="lib/jersey-media-multipart-2.25.1.jar"/>
<classpathentry kind="lib" path="lib/javax.ws.rs-api-2.0.1.jar"/>
+ <classpathentry kind="lib" path="lib/mockito-core-2.8.47.jar" sourcepath="/home/dave/.m2/repository/org/mockito/mockito-core/2.8.47/mockito-core-2.8.47-sources.jar"/>
+ <classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
<classpathentry kind="output" path="target/classes/main"/>
</classpath>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-05-29 20:54:00 UTC (rev 1822)
+++ trunk/fb-contrib/build.xml 2017-07-19 21:29:47 UTC (rev 1823)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.0.2" />
+ <property name="fb-contrib.version" value="7.0.3" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -108,7 +108,8 @@
<path id="fb-contrib.test.classpath">
<pathelement location="${lib.dir}/testng-${testng.version}.jar" />
<pathelement location="${lib.dir}/jcommander-${jcommander.version}.jar" />
- <pathelement location="${lib.dir}/mockito-all-${mockito-all.version}.jar" />
+ <pathelement location="${lib.dir}/mockito-core-${mockito-core.version}.jar" />
+ <pathelement location="${lib.dir}/hamcrest-core-${hamcrest-core.version}.jar" />
<pathelement location="${findbugs.dir}/lib/dom4j-1.6.1.jar" />
<pathelement location="${findbugs.dir}/lib/jaxen-1.1.6.jar" />
@@ -134,7 +135,8 @@
<pathelement location="${lib.dir}/spring-context-${spring-context.version}.jar" />
<pathelement location="${lib.dir}/spring-tx-${spring-tx.version}.jar" />
<pathelement location="${lib.dir}/javax.persistence-${javax.persistence.version}.jar" />
- <pathelement location="${lib.dir}/mockito-all-${mockito-all.version}.jar" />
+ <pathelement location="${lib.dir}/mockito-core-${mockito-core.version}.jar" />
+ <pathelement location="${lib.dir}/hamcrest-core-${hamcrest-core.version}.jar" />
<pathelement location="${lib.dir}/jena-shaded-guava-${jena-shaded-guava.version}.jar" />
<pathelement location="${lib.dir}/javax.ws.rs-api-${javax.ws.rs-api.version}.jar" />
<pathelement location="${lib.dir}/jersey-media-multipart-${jersey-media-multipart.version}.jar" />
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2017-05-29 20:54:00 UTC (rev 1822)
+++ trunk/fb-contrib/etc/bugrank.txt 2017-07-19 21:29:47 UTC (rev 1823)
@@ -64,11 +64,13 @@
+0 BugPattern IKNC_INCONSISTENT_HTTP_ATTRIBUTE_CASING
+0 BugPattern IKNC_INCONSISTENT_HTTP_PARAM_CASING
+1 BugPattern IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES
++0 BugPattern IMC_IMMATURE_CLASS_LOWER_CLASS
+2 BugPattern IMC_IMMATURE_CLASS_NO_EQUALS
+2 BugPattern IMC_IMMATURE_CLASS_NO_HASHCODE
+0 BugPattern IMC_IMMATURE_CLASS_NO_PACKAGE
+2 BugPattern IMC_IMMATURE_CLASS_NO_TOSTRING
+0 BugPattern IMC_IMMATURE_CLASS_PRINTSTACKTRACE
++0 BugPattern IMC_IMMATURE_CLASS_UPPER_PACKAGE
+0 BugPattern IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER
+0 BugPattern IOI_COPY_WITH_READER
+0 BugPattern IOI_DOUBLE_BUFFER_COPY
@@ -162,6 +164,7 @@
+0 BugPattern PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS
+0 BugPattern PSC_PRESIZE_COLLECTIONS
+0 BugPattern PUS_POSSIBLE_UNSUSPECTED_SERIALIZATION
++0 BugPattern RFI_SET_ACCESSIBLE
+0 BugPattern ROOM_REFLECTION_ON_OBJECT_METHODS
+0 BugPattern S508C_APPENDED_STRING
+0 BugPattern S508C_NON_ACCESSIBLE_JCOMPONENT
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-05-29 20:54:00 UTC (rev 1822)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-07-19 21:29:47 UTC (rev 1823)
@@ -20,7 +20,7 @@
<!-- Detectors -->
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
@@ -77,7 +77,7 @@
<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,UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" />
+ <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,COM_PARENT_DELEGATED_CALL" />
@@ -285,7 +285,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.StringifiedTypes" speed="fast" reports="STT_STRING_PARSING_A_FIELD,STT_TOSTRING_STORED_IN_FIELD,STT_TOSTRING_MAP_KEYING" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.ImmatureClass" speed="moderate" reports="IMC_IMMATURE_CLASS_NO_EQUALS,IMC_IMMATURE_CLASS_NO_HASHCODE,IMC_IMMATURE_CLASS_NO_PACKAGE,IMC_IMMATURE_CLASS_NO_TOSTRING,IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES,IMC_IMMATURE_CLASS_PRINTSTACKTRACE,IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ImmatureClass" speed="moderate" reports="IMC_IMMATURE_CLASS_NO_EQUALS,IMC_IMMATURE_CLASS_NO_HASHCODE,IMC_IMMATURE_CLASS_NO_PACKAGE,IMC_IMMATURE_CLASS_NO_TOSTRING,IMC_IMMATURE_CLASS_IDE_GENERATED_PARAMETER_NAMES,IMC_IMMATURE_CLASS_PRINTSTACKTRACE,IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER,IMC_IMMATURE_CLASS_UPPER_PACKAGE,IMC_IMMATURE_CLASS_LOWER_CLASS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.JAXRSIssues" speed="fast" reports="JXI_GET_ENDPOINT_CONSUMES_CONTENT,JXI_INVALID_CONTEXT_PARAMETER_TYPE,JXI_PARM_PARAM_NOT_FOUND_IN_PATH,JXI_UNDEFINED_PARAMETER_SOURCE_IN_ENDPOINT" />
@@ -313,10 +313,11 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT,UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"/>
- <!-- COMMENT OUT FOR POINT RELEASE
+ <!-- COMMENT OUT FOR POINT RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ReflectionIssues" speed="fast" reports="RFI_SET_ACCESSIBLE"/>
COMMENT OUT FOR POINT RELEASE -->
<!-- BugPattern -->
@@ -571,6 +572,8 @@
<BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_NO_TOSTRING" category="STYLE" />
<BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_PRINTSTACKTRACE" category="STYLE" />
<BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_WRONG_FIELD_ORDER" category="STYLE" />
+ <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_UPPER_PACKAGE" category="STYLE" />
+ <BugPattern abbrev="IMC" type="IMC_IMMATURE_CLASS_LOWER_CLASS" category="STYLE" />
<BugPattern abbrev="JXI" type="JXI_GET_ENDPOINT_CONSUMES_CONTENT" category="CORRECTNESS" />
<BugPattern abbrev="JXI" type="JXI_INVALID_CONTEXT_PARAMETER_TYPE" category="CORRECTNESS" />
<BugPattern abbrev="JXI" type="JXI_PARM_PARAM_NOT_FOUND_IN_PATH" category="CORRECTNESS" />
@@ -591,12 +594,13 @@
<BugPattern abbrev="WI" type="WI_DUPLICATE_WIRED_TYPES" category="CORRECTNESS"/>
<BugPattern abbrev="CCI" type="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY" category="CORRECTNESS"/>
<BugPattern abbrev="UTWR" type="UTWR_USE_TRY_WITH_RESOURCES" category="STYLE" experimental="true"/>
- <BugPattern abbrev="SSCU" type="SSCU_SUSPICIOUS_SHADED_CLASS_USE" category="CORRECTNESS" experimental="true"/>
- <BugPattern abbrev="USFW" type="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES" category="CORRECTNESS" experimental="true"/>
- <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION" category="CORRECTNESS" experimental="true"/>
- <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION" category="CORRECTNESS" experimental="true"/>
- <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_CHECKING_REFERENCE" category="CORRECTNESS" experimental="true"/>
- <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED" category="CORRECTNESS" experimental="true"/>
- <BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT" category="CORRECTNESS" experimental="true"/>
- <BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" category="CORRECTNESS" experimental="true"/>
+ <BugPattern abbrev="SSCU" type="SSCU_SUSPICIOUS_SHADED_CLASS_USE" category="CORRECTNESS"/>
+ <BugPattern abbrev="USFW" type="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES" category="CORRECTNESS"/>
+ <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION" category="CORRECTNESS"/>
+ <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION" category="CORRECTNESS"/>
+ <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_CHECKING_REFERENCE" category="CORRECTNESS"/>
+ <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED" category="CORRECTNESS"/>
+ <BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT" category="CORRECTNESS"/>
+ <BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" category="CORRECTNESS"/>
+ <BugPattern abbrev="RFI" type="RFI_SET_ACCESSIBLE" category="CORRECTNESS" experimental="true"/>
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2017-05-29 20:54:00 UTC (rev 1822)
+++ trunk/fb-contrib/etc/messages.xml 2017-07-19 21:29:47 UTC (rev 1823)
@@ -1696,7 +1696,16 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ReflectionIssues">
+ <Details>
+ <![CDATA[
+ <p>Looks for issues around the use of java reflection.</p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger">
<Details></Details>
</Detector>
@@ -3691,8 +3700,8 @@
</BugPattern>
<BugPattern type="UTAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT">
- <ShortDescription>JUnit test method asserts that a value is true or false</ShortDescription>
- <LongDescription>JUnit test method {1} asserts that a value is true or false</LongDescription>
+ <ShortDescription>JUnit test method asserts that a value is equal to true or false</ShortDescription>
+ <LongDescription>JUnit test method {1} asserts that a value is equal to true or false</LongDescription>
<Details>
<![CDATA[
<p>This method asserts that a value is equal to true or false. It is simpler to just
@@ -5318,18 +5327,18 @@
<p>This method builds a key for a map, using a StringBuilder, either implicitly or explicitly. This means the type
of the key is something more t han a String constant, it is a properly formatted String. However, there is no
type based verification that all uses of this key will follow this formatting. It is much better to use a proper, simple,
- bean class that holds two (or more fields) so that it is clear what is expected for key use.
+ bean class that holds two (or more) fields so that it is clear what is expected for key use.
</p>
<p>
Example<br/>
instead of
- {@code
+ <pre><code>
V v = myMap.get(tableName + "-" + columnName);
- }
+ </code></pre>
use
- {@code
+ <pre><code>
V v = myMap.get(new ColumnSpec(tableName, columnName));
- }
+ </code></pre>
where ColumnSpec is a simple bean-like class of your creation. The advantages, are
<ul>
<li>The ColumnSpec fully describes what is expected, you need a tableName and columnName</li>
@@ -5469,7 +5478,30 @@
</Details>
</BugPattern>
+ <BugPattern type="IMC_IMMATURE_CLASS_UPPER_PACKAGE">
+ <ShortDescription>Class is defined in a package with upper case characters</ShortDescription>
+ <LongDescription>Class {0} is defined in a package with upper case characters</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This class is defined within a package that uses upper case letters. Package names are
+ expected to be in the form of alllowercase.</p>
+ ]]>
+ </Details>
+ </BugPattern>
+ <BugPattern type="IMC_IMMATURE_CLASS_LOWER_CLASS">
+ <ShortDescription>Class does not start with an upper case letter</ShortDescription>
+ <LongDescription>Class {0} does not start with an upper case letter</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This class has been given a name that does not start with an upper case letter.
+ Classes should follow a pattern of uppercasing the first letter of each word, AsAnExample</p>
+ ]]>
+ </Details>
+ </BugPattern>
+
+
+
<BugPattern type="JXI_GET_ENDPOINT_CONSUMES_CONTENT">
<ShortDescription>JAX-RS Method implements a GET request but consumes input</ShortDescription>
<LongDescription>JAX-RS Method {1} implements a GET request but consumes input</LongDescription>
@@ -5873,6 +5905,19 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="RFI_SET_ACCESSIBLE">
+ <ShortDescription>Method uses AccessibleObject.setAccessible to modify accessibility of classes</ShortDescription>
+ <LongDescription>Method {1} uses AccessibleObject.setAccessible to modify accessibility of classes</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method uses the reflective setAccessible method to alter the behavior of methods and fields in classes
+ in ways that were not expected to be accessed by the author. Doing so circumvents the protections that the author
+ provided through the class definition, and may expose your application unexpected side effects and problems. This
+ functionality is deprecated in Java 9, and in Java 10 it is expected that this functionality won't work at all.
+ ]]>
+ </Details>
+ </BugPattern>
<!-- BugCode -->
@@ -6016,4 +6061,5 @@
<BugCode abbrev="USFW">Unsynchronized Singleton Field Writes</BugCode>
<BugCode abbrev="OI">Optional Issues</BugCode>
<BugCode abbrev="UAC">Unnecessary Api Conversion</BugCode>
+ <BugCode abbrev="RFI">Reflection Issues</BugCode>
</MessageCollection>
Modified: trunk/fb-contrib/etc/samples.fbp
===================================================================
--- trunk/fb-contrib/etc/samples.fbp 2017-05-29 20:54:00 UTC (rev 1822)
+++ trunk/fb-contrib/etc/samples.fbp 2017-07-19 21:29:47 UTC (rev 1823)
@@ -1,29 +1,30 @@
<Project projectName="sample">
- <Jar>././../target/classes/samples</Jar>
- <AuxClasspathEntry>././../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/commons-codec-1.10.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/commons-collections-3.2.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/commons-lang3-3.4.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/guava-19.0.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/httpclient-4.5.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/httpclient-cache-4.5.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/httpcore-4.4.5.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/junit-4.12.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/log4j-1.2.17.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/mockito-all-2.0.2-beta.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/slf4j-api-1.7.21.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/threetenbp-1.3.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/commons-io-2.4.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/testng-6.9.10.jar</AuxClasspathEntry>
- <AuxClasspathEntry>../lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>../lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry>
- <SrcDir>./../src/samples/java</SrcDir>
+ <Jar>././././../target/classes/samples</Jar>
+ <AuxClasspathEntry>././././../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/commons-codec-1.10.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/commons-collections-3.2.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/commons-lang3-3.4.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/guava-19.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/httpclient-4.5.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/httpclient-cache-4.5.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/httpcore-4.4.5.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/junit-4.12.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/log4j-1.2.17.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/slf4j-api-1.7.21.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/threetenbp-1.3.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/commons-io-2.4.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././././../lib/testng-6.9.10.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././../lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./../lib/mockito-core-2.8.47.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/hamcrest-core-1.3.jar</AuxClasspathEntry>
+ <SrcDir>./././../src/samples/java</SrcDir>
</Project>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2017-05-29 20:54:00 UTC (rev 1822)
+++ trunk/fb-contrib/htdocs/index.shtml 2017-07-19 21:29:47 UTC (rev 1823)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.2 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.3 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2017-05-29 20:54:00 UTC (rev 1822)
+++ trunk/fb-contrib/htdocs/repository.html 2017-07-19 21:29:47 UTC (rev 1823)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.0.2</td></tr>
+ <tr><td><b>Version:</b></td><td>7.0.3</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-05-29 20:54:00 UTC (rev 1822)
+++ trunk/fb-contrib/pom.xml 2017-07-19 21:29:47 UTC (rev 1823)
@@ -1,23 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- pom.xml developed by Grzegorz Slowikowski -->
-<project
- xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.0.2</version>
+ <version>7.0.3</version>
+ <!-- TODO: Delete this and replace with enforcer plugin. This is for maven plugins only! Latest maven will through warnings. -->
<prerequisites>
- <maven>2.2.1</maven>
+ <maven>3.2.5</maven>
</prerequisites>
+ <!-- TODO: Oss parent is obsolete, define items directly for releasing -->
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
- <version>5</version>
+ <version>9</version>
+ <relativePath />
</parent>
<name>FindBugs Contrib plugin library</name>
@@ -71,15 +72,18 @@
<email>she...@ya...</email>
</contributor>
<contributor>
- <name>Juan Martín Sotuyo Dodero</name>
- <email>jua...@gm...</email>
+ <name>Juan Martín Sotuyo Dodero</name>
+ <email>jua...@gm...</email>
</contributor>
<contributor>
- <name>Richard Fearn</name>
+ <name>Richard Fearn</name>
</contributor>
<contributor>
- <name>Mikkel Kjeldsen</name>
+ <name>Mikkel Kjeldsen</name>
</contributor>
+ <contributor>
+ <name>Jeremy Landis</name>
+ </contributor>
</contributors>
<licenses>
@@ -130,6 +134,12 @@
<artifactId>findbugs</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
@@ -140,69 +150,166 @@
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
- <version>3.0.0</version>
+ <version>3.0.1u2</version>
<scope>provided</scope>
</dependency>
- <dependency><scope>test</scope><groupId>backport-util-concurrent</groupId><artifactId>backport-util-concurrent</artifactId><version>3.1</version></dependency>
- <dependency><scope>test</scope><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>19.0</version></dependency>
- <dependency><scope>test</scope><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.10</version></dependency>
- <dependency><scope>test</scope><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.4</version></dependency>
- <dependency><scope>test</scope><groupId>commons-collections</groupId><artifactId>commons-collections</artifactId><version>3.2.2</version></dependency>
- <dependency><scope>test</scope><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.1.0</version></dependency>
- <dependency><scope>test</scope><groupId>javax.servlet.jsp</groupId><artifactId>javax.servlet.jsp-api</artifactId><version>2.3.1</version></dependency>
- <dependency><scope>test</scope><groupId>javax.ws.rs</groupId><artifactId>javax.ws.rs-api</artifactId><version>2.0.1</version></dependency>
- <dependency><scope>test</scope><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency>
- <dependency><scope>test</scope><groupId>log4j</groupId><artifactId>log4j</artifactId><version>1.2.17</version></dependency>
- <dependency><scope>test</scope><groupId>org.apache.commons</groupId><artifactId>commons-lang3</artifactId><version>3.3</version></dependency>
- <dependency><scope>test</scope><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.5.2</version></dependency>
- <dependency><scope>test</scope><groupId>org.apache.httpcomponents</groupId><artifactId>httpcore</artifactId><version>4.4.5</version></dependency>
- <dependency><scope>test</scope><groupId>org.mockito</groupId><artifactId>mockito-all</artifactId><version>2.0.2-beta</version></dependency>
- <dependency><scope>test</scope><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.21</version></dependency>
- <dependency><scope>test</scope><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>4.3.3.RELEASE</version></dependency>
- <dependency><scope>test</scope><groupId>org.testng</groupId><artifactId>testng</artifactId><version>6.9.10</version></dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>4.3.3.RELEASE</version>
- <scope>test</scope>
+ <scope>test</scope>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>3.1</version>
</dependency>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>4.3.3.RELEASE</version>
- <scope>test</scope>
+ <scope>test</scope>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</ar...
[truncated message content] |
|
From: <dbr...@us...> - 2017-09-04 17:52:11
|
Revision: 1825
http://sourceforge.net/p/fb-contrib/code/1825
Author: dbrosius
Date: 2017-09-04 17:52:07 +0000 (Mon, 04 Sep 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/samples.fbp
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContainsBasedConditional.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/ToString.java
trunk/fb-contrib/src/samples/java/ex/COM_Sample.java
trunk/fb-contrib/src/samples/java/ex/LEST_Sample.java
trunk/fb-contrib/src/samples/java/ex/LII_Sample.java
trunk/fb-contrib/src/samples/java/ex/PDP_Sample.java
trunk/fb-contrib/src/samples/java/ex/PSC_Sample.java
trunk/fb-contrib/src/samples/java/ex/SEO_Sample.java
trunk/fb-contrib/src/samples/java/ex/SUA_Sample.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/build.xml 2017-09-04 17:52:07 UTC (rev 1825)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.0.3" />
+ <property name="fb-contrib.version" value="7.0.4" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-09-04 17:52:07 UTC (rev 1825)
@@ -20,7 +20,7 @@
<!-- Detectors -->
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
@@ -318,6 +318,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.ReflectionIssues" speed="fast" reports="RFI_SET_ACCESSIBLE"/>
+
COMMENT OUT FOR POINT RELEASE -->
<!-- BugPattern -->
Modified: trunk/fb-contrib/etc/samples.fbp
===================================================================
--- trunk/fb-contrib/etc/samples.fbp 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/etc/samples.fbp 2017-09-04 17:52:07 UTC (rev 1825)
@@ -1,30 +1,30 @@
<Project projectName="sample">
- <Jar>././././../target/classes/samples</Jar>
- <AuxClasspathEntry>././././../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/commons-codec-1.10.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/commons-collections-3.2.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/commons-lang3-3.4.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/guava-19.0.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/httpclient-4.5.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/httpclient-cache-4.5.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/httpcore-4.4.5.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/junit-4.12.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/log4j-1.2.17.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/slf4j-api-1.7.21.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/threetenbp-1.3.2.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/commons-io-2.4.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././././../lib/testng-6.9.10.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>././../lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./../lib/mockito-core-2.8.47.jar</AuxClasspathEntry>
+ <Jar>../target/classes/samples</Jar>
+ <AuxClasspathEntry>../lib/asm-debug-all-5.0.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/commons-codec-1.10.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/commons-collections-3.2.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/commons-lang3-3.4.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/guava-19.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/httpclient-4.5.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/httpclient-cache-4.5.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/httpcore-4.4.5.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/javax.persistence-2.1.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/javax.servlet-api-3.1.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/javax.servlet.jsp-api-2.3.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/junit-4.12.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/log4j-1.2.17.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/slf4j-api-1.7.21.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/spring-beans-4.3.3.RELEASE.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/spring-context-4.3.3.RELEASE.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/spring-tx-4.3.3.RELEASE.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/threetenbp-1.3.2.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/jena-shaded-guava-3.1.0.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/commons-io-2.4.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/testng-6.9.10.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/javax.ws.rs-api-2.0.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/jersey-media-multipart-2.25.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>../lib/mockito-core-2.8.47.jar</AuxClasspathEntry>
<AuxClasspathEntry>../lib/hamcrest-core-1.3.jar</AuxClasspathEntry>
- <SrcDir>./././../src/samples/java</SrcDir>
+ <SrcDir>../src/samples/java</SrcDir>
</Project>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/htdocs/index.shtml 2017-09-04 17:52:07 UTC (rev 1825)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.3 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.4 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/htdocs/repository.html 2017-09-04 17:52:07 UTC (rev 1825)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.0.3</td></tr>
+ <tr><td><b>Version:</b></td><td>7.0.4 or 7.0.4.sb</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/pom.xml 2017-09-04 17:52:07 UTC (rev 1825)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.0.3</version>
+ <version>7.0.4</version>
<!-- TODO: Delete this and replace with enforcer plugin. This is for maven plugins only! Latest maven will through warnings. -->
<prerequisites>
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -249,6 +249,7 @@
for (int offset : offsets) {
casePositions.set(pc + offset);
}
+ casePositions.set(pc + getDefaultSwitchOffset());
}
} finally {
stack.sawOpcode(this, seen);
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContainsBasedConditional.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContainsBasedConditional.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContainsBasedConditional.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -18,8 +18,7 @@
*/
package com.mebigfatguy.fbcontrib.detect;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.BitSet;
import org.apache.bcel.classfile.Code;
import org.apache.bcel.classfile.Constant;
@@ -54,7 +53,7 @@
private BugReporter bugReporter;
private OpcodeStack stack;
- private List<Integer> switchLocs;
+ private BitSet switchLocs;
private State state;
private int loadType;
private String constType;
@@ -75,7 +74,7 @@
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
- switchLocs = new ArrayList<Integer>();
+ switchLocs = new BitSet();
super.visitClassContext(classContext);
} finally {
switchLocs = null;
@@ -101,17 +100,18 @@
try {
stack.precomputation(this);
+ int pc = getPC();
if ((seen == LOOKUPSWITCH) || (seen == TABLESWITCH)) {
- switchLocs.add(Integer.valueOf(getPC()));
+ switchLocs.set(pc);
for (int offset : getSwitchOffsets()) {
- switchLocs.add(Integer.valueOf(getPC() + offset));
+ switchLocs.set(pc + offset);
}
+ switchLocs.set(pc + getDefaultSwitchOffset());
}
- if (!switchLocs.isEmpty() && (getPC() == switchLocs.get(0).intValue())) {
+ if (switchLocs.get(pc)) {
state = State.SAW_NOTHING;
- switchLocs.remove(0);
- return;
+ switchLocs.clear(pc);
}
switch (state) {
@@ -128,7 +128,7 @@
}
} else {
loadType = seen;
- bugPC = getPC();
+ bugPC = pc;
state = State.SAW_LOAD;
}
} else {
@@ -175,7 +175,8 @@
break;
case SAW_CONST:
- if ((seen == INVOKEVIRTUAL) && "equals".equals(getNameConstantOperand()) && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(getSigConstantOperand())) {
+ if ((seen == INVOKEVIRTUAL) && "equals".equals(getNameConstantOperand())
+ && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(getSigConstantOperand())) {
state = State.SAW_EQUALS;
} else if (seen == IF_ICMPEQ) {
conditionCount++;
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -33,6 +33,7 @@
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.InvokeInstruction;
import org.apache.bcel.generic.LDC;
+import org.apache.bcel.generic.LDC2_W;
import org.apache.bcel.generic.ReferenceType;
import org.apache.bcel.generic.Type;
@@ -144,6 +145,10 @@
return;
}
+ if ((getMethod().getAccessFlags() & ACC_SYNCHRONIZED) != (superCode.getAccess() & ACC_SYNCHRONIZED)) {
+ return;
+ }
+
parmTypes = getMethod().getArgumentTypes();
nextParmIndex = 0;
nextParmOffset = getMethod().isStatic() ? 0 : 1;
@@ -248,7 +253,7 @@
* @return whether the access modifiers are the same
*/
private static boolean sameAccess(int parentAccess, int childAccess) {
- return ((parentAccess & (Constants.ACC_PUBLIC | Constants.ACC_PROTECTED)) == (childAccess & (Constants.ACC_PUBLIC | Constants.ACC_PROTECTED)));
+ return ((parentAccess & (Constants.ACC_PUBLIC | Constants.ACC_PROTECTED)) == ((childAccess & (Constants.ACC_PUBLIC | Constants.ACC_PROTECTED))));
}
/**
@@ -351,6 +356,20 @@
return false;
}
// TODO: Other Constant types
+ } else if (childin instanceof LDC2_W) {
+ Type childType = ((LDC2_W) childin).getType(childPoolGen);
+ Type parentType = ((LDC2_W) parentin).getType(parentPoolGen);
+ if (!childType.equals(parentType)) {
+ return false;
+ }
+
+ Object childValue = ((LDC2_W) childin).getValue(childPoolGen);
+ Object parentValue = ((LDC2_W) parentin).getValue(parentPoolGen);
+
+ if (!childValue.equals(parentValue)) {
+ return false;
+ }
+
} else {
if (!childin.equals(parentin)) {
return false;
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -406,16 +406,24 @@
return true;
}
} else {
+ XField newField = itm.getXField();
+ if (newField == null) {
+ return true;
+ }
+
XField seenField = loopCollectionItem.getXField();
- if (seenField != null) {
- if (itm.getRegisterNumber() >= 0) {
- return true;
- }
- XField newField = itm.getXField();
- if ((newField != null) && (!newField.getName().equals(seenField.getName()))) {
- return true;
- }
+ if (seenField == null) {
+ return true;
}
+
+ if (itm.getRegisterNumber() >= 0) {
+ return true;
+ }
+
+ if ((loopCollectionItem.getFieldLoadedFromRegister() != itm.getFieldLoadedFromRegister()) || (itm.getFieldLoadedFromRegister() == -1)
+ || (!newField.getName().equals(seenField.getName()))) {
+ return true;
+ }
}
loopCollectionItem = itm;
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -75,7 +75,7 @@
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
- lookupSwitches = new ArrayList<LookupDetails>();
+ lookupSwitches = new ArrayList<>();
super.visitClassContext(classContext);
} finally {
stack = null;
@@ -173,6 +173,7 @@
for (int offset : offsets) {
bs.set(pc + offset);
}
+ bs.set(pc + getDefaultSwitchOffset());
lookupSwitches.add(new LookupDetails(stringRef, bs));
}
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -264,6 +264,10 @@
break;
}
}
+ if (catchInfo.getFinish() == Integer.MAX_VALUE) {
+ catchInfo.setFinish(pc);
+ }
+
} else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) {
if (lastWasExitPoint) {
// crazy jdk6 finally block injection -- shut
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -28,6 +28,7 @@
import org.apache.bcel.classfile.Method;
import com.mebigfatguy.fbcontrib.utils.BugType;
+import com.mebigfatguy.fbcontrib.utils.QMethod;
import com.mebigfatguy.fbcontrib.utils.SignatureUtils;
import com.mebigfatguy.fbcontrib.utils.UnmodifiableSet;
import com.mebigfatguy.fbcontrib.utils.Values;
@@ -55,11 +56,11 @@
/**
* methodname:methodsig to type of setter methods
*/
- private Map<String, String> attributes;
+ private Map<QMethod, String> attributes;
/**
- * methodname:methodsig to (fieldname:fieldtype)s
+ * QMethod to (fieldname:fieldtype)s
*/
- private Map<String, Map<String, SourceLineAnnotation>> methodWrites;
+ private Map<QMethod, Map<String, SourceLineAnnotation>> methodWrites;
private Map<String, FieldAnnotation> fieldAnnotations;
/**
@@ -113,8 +114,8 @@
* the class to look for setter methods to infer properties
* @return the map of possible attributes/types
*/
- private static Map<String, String> getAttributes(JavaClass cls) {
- Map<String, String> atts = new HashMap<>();
+ private static Map<QMethod, String> getAttributes(JavaClass cls) {
+ Map<QMethod, String> atts = new HashMap<>();
Method[] methods = cls.getMethods();
for (Method m : methods) {
String name = m.getName();
@@ -126,7 +127,7 @@
if (validAttrTypes.contains(parmSig)) {
Code code = m.getCode();
if ((code != null) && (code.getCode().length < MAX_ATTRIBUTE_CODE_LENGTH)) {
- atts.put(name + ':' + sig, parmSig);
+ atts.put(new QMethod(name, sig), parmSig);
}
}
}
@@ -158,7 +159,7 @@
@Override
public void sawOpcode(int seen) {
if (seen == PUTFIELD) {
- String methodInfo = getMethodName() + ':' + getMethodSig();
+ QMethod methodInfo = new QMethod(getMethodName(), getMethodSig());
Map<String, SourceLineAnnotation> fields = methodWrites.get(methodInfo);
if (fields == null) {
fields = new HashMap<>();
@@ -177,8 +178,8 @@
* generates all the bug reports for attributes that are not recycleable
*/
private void reportBugs() {
- for (Map.Entry<String, String> attEntry : attributes.entrySet()) {
- String methodInfo = attEntry.getKey();
+ for (Map.Entry<QMethod, String> attEntry : attributes.entrySet()) {
+ QMethod methodInfo = attEntry.getKey();
String attType = attEntry.getValue();
Map<String, SourceLineAnnotation> fields = methodWrites.get(methodInfo);
@@ -196,7 +197,7 @@
String fieldName = fieldInfo.substring(0, colonPos);
- for (Map.Entry<String, Map<String, SourceLineAnnotation>> fwEntry : methodWrites.entrySet()) {
+ for (Map.Entry<QMethod, Map<String, SourceLineAnnotation>> fwEntry : methodWrites.entrySet()) {
if (fwEntry.getKey().equals(methodInfo)) {
continue;
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -76,6 +76,10 @@
public void visitCode(Code obj) {
try {
Method m = getMethod();
+ if (m.isSynthetic()) {
+ return;
+ }
+
if (m.isStatic() || m.isPrivate() || Values.CONSTRUCTOR.equals(m.getName())) {
parmSigs = SignatureUtils.getParameterSlotAndSignatures(m.isStatic(), m.getSignature());
if (!parmSigs.isEmpty() && prescreen(m)) {
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -268,6 +268,7 @@
for (int offset : offsets) {
branchTargets.set(offset + pc);
}
+ branchTargets.set(getDefaultSwitchOffset() + pc);
} else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) {
localMethodCalls.remove(Integer.valueOf(RegisterUtils.getAStoreReg(this, seen)));
} else if (seen == PUTFIELD) {
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java 2017-07-19 21:31:58 UTC (rev 1824)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java 2017-09-04 17:52:07 UTC (rev 1825)
@@ -19,6 +19,7 @@
package com.mebigfatguy.fbcontrib.detect;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -26,6 +27,7 @@
import java.util.Set;
import org.apache.bcel.classfile.Code;
+import org.apache.bcel.classfile.CodeException;
import com.mebigfatguy.fbcontrib.utils.BugType;
import com.mebigfatguy.fbcontrib.utils.SignatureBuilder;
@@ -42,235 +44,344 @@
import edu.umd.cs.findbugs.ba.ClassContext;
/**
- * finds methods that create and populate collections, and while knowing the end size of those collections, does not pre allocate the collection to be big
- * enough. This just causes unneeded reallocations putting strain on the garbage collector.
+ * finds methods that create and populate collections, and while knowing the end
+ * size of those collections, does not pre allocate the collection to be big
+ * enough. This just causes unneeded reallocations putting strain on the garbage
+ * collector.
*/
@CustomUserValue
public class PresizeCollections extends BytecodeScanningDetector {
- private static final Set<String> PRESIZEABLE_COLLECTIONS = UnmodifiableSet.create("java/util/ArrayBlockingQueue", "java/util/ArrayDeque",
- "java/util/ArrayList", "java/util/HashMap", "java/util/HashSet", "java/util/LinkedBlockingQueue", "java/util/LinkedHashMap",
- "java/util/LinkedHashSet", "java/util/PriorityBlockingQueue", "java/util/PriorityQueue", "java/util/Vector");
+ private static final Set<String> PRESIZEABLE_COLLECTIONS = UnmodifiableSet.create("java/util/ArrayBlockingQueue",
+ "java/util/ArrayDeque", "java/util/ArrayList", "java/util/HashMap", "java/util/HashSet",
+ "java/util/LinkedBlockingQueue", "java/util/LinkedHashMap", "java/util/LinkedHashSet",
+ "java/util/PriorityBlockingQueue", "java/util/PriorityQueue", "java/util/Vector");
- private BugReporter bugReporter;
- private OpcodeStack stack;
- private int allocNumber;
- private Map<Integer, Integer> allocLocation;
- private Map<Integer, List<Integer>> allocToAddPCs;
- private List<DownBranch> downBranches;
+ private BugReporter bugReporter;
+ private OpcodeStack stack;
+ private int nextAllocNumber;
+ private Map<Comparable<?>, Integer> storeToAllocNumber;
+ private Map<Integer, Integer> allocLocation;
+ private Map<Integer, List<Integer>> allocToAddPCs;
+ private List<CodeRange> optionalRanges;
- public PresizeCollections(BugReporter bugReporter) {
- this.bugReporter = bugReporter;
- }
+ public PresizeCollections(BugReporter bugReporter) {
+ this.bugReporter = bugReporter;
+ }
- /**
- * overrides the visitor to initialize the opcode stack
- *
- * @param classContext
- * the context object that holds the JavaClass being parsed
- */
- @Override
- public void visitClassContext(ClassContext classContext) {
- try {
- stack = new OpcodeStack();
- allocLocation = new HashMap<>();
- allocToAddPCs = new HashMap<>();
- downBranches = new ArrayList<>();
- super.visitClassContext(classContext);
- } finally {
- stack = null;
- allocLocation = null;
- allocToAddPCs = null;
- downBranches = null;
- }
- }
+ /**
+ * overrides the visitor to initialize the opcode stack
+ *
+ * @param classContext
+ * the context object that holds the JavaClass being parsed
+ */
+ @Override
+ public void visitClassContext(ClassContext classContext) {
+ try {
+ stack = new OpcodeStack();
+ storeToAllocNumber = new HashMap<>();
+ allocLocation = new HashMap<>();
+ allocToAddPCs = new HashMap<>();
+ optionalRanges = new ArrayList<>();
+ super.visitClassContext(classContext);
+ } finally {
+ stack = null;
+ storeToAllocNumber = null;
+ allocLocation = null;
+ allocToAddPCs = null;
+ optionalRanges = null;
+ }
+ }
- /**
- * implements the visitor to reset the opcode stack
- *
- * @param obj
- * the context object of the currently parsed code block
- */
- @Override
- public void visitCode(Code obj) {
- stack.resetForMethodEntry(this);
- allocNumber = 0;
- allocLocation.clear();
- allocToAddPCs.clear();
- downBranches.clear();
- super.visitCode(obj);
+ /**
+ * implements the visitor to reset the opcode stack
+ *
+ * @param obj
+ * the context object of the currently parsed code block
+ */
+ @Override
+ public void visitCode(Code obj) {
+ stack.resetForMethodEntry(this);
+ nextAllocNumber = 1;
+ storeToAllocN...
[truncated message content] |
|
From: <dbr...@us...> - 2017-09-24 01:16:37
|
Revision: 1827
http://sourceforge.net/p/fb-contrib/code/1827
Author: dbrosius
Date: 2017-09-24 01:16:34 +0000 (Sun, 24 Sep 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bugrank.txt
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java
trunk/fb-contrib/src/samples/java/ex/LO_Sample.java
trunk/fb-contrib/src/samples/java/ex/OI_Sample.java
trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/build.xml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.0.4" />
+ <property name="fb-contrib.version" value="7.0.5" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/etc/bugrank.txt 2017-09-24 01:16:34 UTC (rev 1827)
@@ -107,6 +107,7 @@
+0 BugPattern LO_STUTTERED_MESSAGE
+0 BugPattern LO_SUSPECT_LOG_CLASS
+0 BugPattern LO_SUSPECT_LOG_PARAMETER
++0 BugPattern LO_TOSTRING_PARAMETER
+2 BugPattern LSC_LITERAL_STRING_COMPARISON
+0 BugPattern LSYC_LOCAL_SYNCHRONIZED_COLLECTION
+2 BugPattern MAC_MANUAL_ARRAY_COPY
@@ -152,6 +153,7 @@
+0 BugPattern OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED
+0 BugPattern OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION
+0 BugPattern OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION
++0 BugPattern OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL
+0 BugPattern OPM_OVERLY_PERMISSIVE_METHOD
+0 BugPattern PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP
+2 BugPattern PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -176,7 +176,7 @@
<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_LOGGER_LOST_EXCEPTION_STACK_TRACE,LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER,LO_STUTTERED_MESSAGE,LO_INVALID_FORMATTING_ANCHOR,LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING,LO_INVALID_STRING_FORMAT_NOTATION,LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" speed="fast" reports="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE,LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER,LO_STUTTERED_MESSAGE,LO_INVALID_FORMATTING_ANCHOR,LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING,LO_INVALID_STRING_FORMAT_NOTATION,LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING,LO_TOSTRING_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" />
@@ -309,7 +309,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnsynchronizedSingletonFieldWrites" speed="fast" reports="USFW_UNSYNCHRONIZED_SINGLETON_FIELD_WRITES"/>
- <Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED"/>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED,OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT,UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"/>
@@ -482,7 +482,8 @@
<BugPattern abbrev="LO" type="LO_EXCEPTION_WITH_LOGGER_PARMS" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_APPENDED_STRING_IN_FORMAT_STRING" category="PERFORMANCE" />
<BugPattern abbrev="LO" type="LO_INVALID_STRING_FORMAT_NOTATION" category="CORRECTNESS" />
- <BugPattern abbrev="LO" type="LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING" />
+ <BugPattern abbrev="LO" type="LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING" category="CORRECTNESS"/>
+ <BugPattern abbrev="LO" type="LO_TOSTRING_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" />
@@ -601,6 +602,7 @@
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION" category="CORRECTNESS"/>
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_CHECKING_REFERENCE" category="CORRECTNESS"/>
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED" category="CORRECTNESS"/>
+ <BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL" category="CORRECTNESS" />
<BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT" category="CORRECTNESS"/>
<BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" category="CORRECTNESS"/>
<BugPattern abbrev="RFI" type="RFI_SET_ACCESSIBLE" category="CORRECTNESS" experimental="true"/>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/etc/messages.xml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -4117,6 +4117,21 @@
</Details>
</BugPattern>
+ <BugPattern type="LO_TOSTRING_PARAMETER">
+ <ShortDescription>Method explicitly calls toString() on a logger parameter</ShortDescription>
+ <LongDescription>Method {1} explicitly calls toString() on a logger parameter</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method uses parameterized logging to avoid the cost of string concatenation in the case that
+ the log level does not meet the needed level. However, one or more of the parameters passed to the logging
+ method uses .toString() to present a String representation for the parameter. This is unneeded as the logger
+ will do this for you, and because it is explicitly done, will always be called even if the log statement is
+ not actually written. Also, by dropping the '.toString()' you may avoid unnecessary NPEs.
+ Just pass the variable as a parameter instead.
+ ]]>
+ </Details>
+ </BugPattern>
+
<BugPattern type="IICU_INCORRECT_INTERNAL_CLASS_USE">
<ShortDescription>Class relies on internal API classes</ShortDescription>
<LongDescription>Class {0} relies on internal API classes</LongDescription>
@@ -5880,6 +5895,18 @@
</Details>
</BugPattern>
+ <BugPattern type="OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL">
+ <ShortDescription>Method uses Optional.orElseGet(null)</ShortDescription>
+ <LongDescription>Method {1} uses Optional.orElseGet(null)</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method uses Optional.orElseGet(null). This method is supposed to to receive a lambda expression for what to execute
+ when the Optional is not there. If you want to just return null, use Optional.orElse(null) instead.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<BugPattern type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT">
<ShortDescription>Method constructs a Date object, merely to convert it to an Instant object</ShortDescription>
<LongDescription>Method {1} constructs a Date object, merely to convert it to an Instant object</LongDescription>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/htdocs/index.shtml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.4 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.5 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/htdocs/repository.html 2017-09-24 01:16:34 UTC (rev 1827)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.0.4 or 7.0.4.sb</td></tr>
+ <tr><td><b>Version:</b></td><td>7.0.5 or 7.0.5.sb</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/pom.xml 2017-09-24 01:16:34 UTC (rev 1827)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.0.4</version>
+ <version>7.0.5</version>
<!-- TODO: Delete this and replace with enforcer plugin. This is for maven plugins only! Latest maven will through warnings. -->
<prerequisites>
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -141,8 +141,8 @@
String clsName = SignatureUtils.stripSignature(signature);
JavaClass cls = Repository.lookupClass(clsName);
if ((cls.implementationOf(mapInterface) && !name.endsWith("map")) || (cls.implementationOf(setInterface) && !name.endsWith("set"))
- || (cls.implementationOf(listInterface) && !name.endsWith("list"))
- || (cls.implementationOf(queueInterface) && !name.endsWith("queue"))) {
+ || ((cls.implementationOf(listInterface) || cls.implementationOf(queueInterface)) && !name.endsWith("list")
+ && !name.endsWith("queue"))) {
return true;
}
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -160,9 +160,10 @@
public void sawOpcode(int seen) {
String ldcClassName = null;
String seenMethodName = null;
+ boolean seenToString = false;
int exMessageReg = -1;
Integer arraySize = null;
- Boolean simpleFormat = null;
+ boolean simpleFormat = false;
try {
stack.precomputation(this);
@@ -182,7 +183,7 @@
if (format != null) {
Matcher m = NON_SIMPLE_FORMAT.matcher(format);
if (!m.matches()) {
- simpleFormat = Boolean.TRUE;
+ simpleFormat = true;
}
}
}
@@ -218,6 +219,10 @@
seenMethodName = mthName;
}
}
+
+ if (seenMethodName == null) {
+ seenToString = true;
+ }
}
} else if (seen == INVOKESPECIAL) {
checkForLoggerParam();
@@ -245,7 +250,7 @@
LOUserValue<String> uv = (LOUserValue<String>) item.getUserValue();
if (uv != null) {
if (((uv.getType() == LOUserValue.LOType.METHOD_NAME) && Values.TOSTRING.equals(uv.getValue()))
- || (uv.getType() == LOUserValue.LOType.SIMPLE_FORMAT)) {
+ || (uv.getType() == LOUserValue.LOType.SIMPLE_FORMAT) || (uv.getType() == LOUserValue.LOType.TOSTRING)) {
item.setUserValue(new LOUserValue<>(LOUserValue.LOType.NULL, null));
}
}
@@ -267,8 +272,10 @@
item.setUserValue(new LOUserValue<>(LOUserValue.LOType.MESSAGE_REG, Integer.valueOf(exMessageReg)));
} else if (arraySize != null) {
item.setUserValue(new LOUserValue<>(LOUserValue.LOType.ARRAY_SIZE, arraySize));
- } else if (simpleFormat != null) {
- item.setUserValue(new LOUserValue<>(LOUserValue.LOType.SIMPLE_FORMAT, simpleFormat));
+ } else if (simpleFormat) {
+ item.setUserValue(new LOUserValue<>(LOUserValue.LOType.SIMPLE_FORMAT, Boolean.TRUE));
+ } else if (seenToString) {
+ item.setUserValue(new LOUserValue<>(LOUserValue.LOType.TOSTRING, null));
}
}
}
@@ -352,11 +359,28 @@
}
}
}
+
+ boolean foundToString = false;
+ for (int i = 0; i < (numParms - 1); i++) {
+ OpcodeStack.Item itm = stack.getStackItem(i);
+ LOUserValue<?> uv = (LOUserValue<?>) itm.getUserValue();
+ foundToString = ((uv != null)
+ && ((uv.getType() == LOUserValue.LOType.TOSTRING) || (uv.getType() == LOUserValue.LOType.METHOD_NAME)));
+ if (foundToString) {
+ break;
+ }
+ }
+
+ if (foundToString) {
+ bugReporter.reportBug(new BugInstance(this, BugType.LO_TOSTRING_PARAMETER.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
+ .addSourceLine(this));
+ }
}
}
}
}
+
}
/**
@@ -553,7 +577,7 @@
static class LOUserValue<T> {
enum LOType {
- CLASS_NAME, METHOD_NAME, MESSAGE_REG, ARRAY_SIZE, SIMPLE_FORMAT, NULL
+ CLASS_NAME, METHOD_NAME, MESSAGE_REG, ARRAY_SIZE, SIMPLE_FORMAT, TOSTRING, NULL
};
LOType type;
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -206,14 +206,20 @@
if (!activeStackOps.isEmpty()) {
ActiveStackOp op = activeStackOps.getLast();
- Method getMethod = getLambdaMethod(op.getMethod().getMethodName());
- if (getMethod != null) {
- byte[] byteCode = getMethod.getCode().getCode();
- if (byteCode.length <= 4) {
- // we are looking for ALOAD, GETFIELD, or LDC followed by ARETURN, that should fit in 4 bytes
- if (!hasInvoke(byteCode)) {
- bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION.name(), LOW_PRIORITY)
- .addClass(this).addMethod(this).addSourceLine(this));
+ FQMethod method = op.getMethod();
+ if (method == null) {
+ bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL.name(), LOW_PRIORITY)
+ .addClass(this).addMethod(this).addSourceLine(this));
+ } else {
+ Method getMethod = getLambdaMethod(method.getMethodName());
+ if (getMethod != null) {
+ byte[] byteCode = getMethod.getCode().getCode();
+ if (byteCode.length <= 4) {
+ // we are looking for ALOAD, GETFIELD, or LDC followed by ARETURN, that should fit in 4 bytes
+ if (!hasInvoke(byteCode)) {
+ bugReporter.reportBug(new BugInstance(this, BugType.OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION.name(), LOW_PRIORITY)
+ .addClass(this).addMethod(this).addSourceLine(this));
+ }
}
}
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -45,7 +45,8 @@
private final List<String> knownExceptions = UnmodifiableList.create(
// @formatter:off
- "uk/org/lidalia/"
+ "uk/org/lidalia/",
+ "au/com/bytecode/"
// @formatter:on
);
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -140,6 +140,7 @@
LO_STUTTERED_MESSAGE,
LO_SUSPECT_LOG_CLASS,
LO_SUSPECT_LOG_PARAMETER,
+ LO_TOSTRING_PARAMETER,
LSC_LITERAL_STRING_COMPARISON,
LSYC_LOCAL_SYNCHRONIZED_COLLECTION,
@@ -188,6 +189,7 @@
OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED,
OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,
OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,
+ OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL,
OPM_OVERLY_PERMISSIVE_METHOD,
PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP,
Modified: trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/samples/java/ex/CNC_Sample.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -1,6 +1,8 @@
package ex;
+
import java.util.Collections;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -13,6 +15,8 @@
// tag CNC_COLLECTION_NAMING_CONFUSION
List<Double> bernoulliSet;
+ LinkedList<String> mLinkedList = new LinkedList<>();
+
// tag 3xCNC_COLLECTION_NAMING_CONFUSION
public void testCNC(Map<String, String> argSet, Set<String> nameList, List<String> nameMap) {
Modified: trunk/fb-contrib/src/samples/java/ex/LO_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/LO_Sample.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/samples/java/ex/LO_Sample.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -102,6 +102,16 @@
l3.error(String.format("The error was %s", poo));
}
+ public void testToStringInParm(List<Long> data) {
+ l3.info("This is a parm: {}", data.toString());
+ }
+
+ public String testReuseToStringInParm(List<Long> data) {
+ String info = data.toString();
+ l3.info("This is a parm: {}", info);
+ return info;
+ }
+
public void testFPReuseofSimpleFormatter(String poo) {
String s = String.format("The error was %s", poo);
l3.error(s);
Modified: trunk/fb-contrib/src/samples/java/ex/OI_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/OI_Sample.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/samples/java/ex/OI_Sample.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -1,4 +1,6 @@
package ex;
+
+import java.util.Date;
import java.util.Optional;
import java.util.OptionalDouble;
import java.util.OptionalInt;
@@ -36,6 +38,10 @@
return Optional.of(3.14);
}
+ public Date orElseGetNull(Optional<Date> o) {
+ return o.orElseGet(null);
+ }
+
public String fpDelayedOK(Optional<String> o, String a, String b) {
return o.orElseGet(() -> String.format("%s boo %s hiss", a, b));
@@ -54,5 +60,4 @@
public Long fpBoxingIsTooCommon(Optional<Long> o) {
return o.orElse(0L);
}
-
}
Modified: trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java 2017-09-04 17:55:39 UTC (rev 1826)
+++ trunk/fb-contrib/src/samples/java/ex/UCPM_Sample.java 2017-09-24 01:16:34 UTC (rev 1827)
@@ -2,6 +2,12 @@
public class UCPM_Sample {
+ private static final String A;
+
+ static {
+ A = "A";
+ }
+
private StringBuffer sb; // made this a field to avoid "unnecessary use of
// synchronized class"
@@ -67,4 +73,10 @@
StringBuilder sb = new StringBuilder();
return sb.append("(").append(value).append(")").toString();
}
+
+ public String fpStaticFinalField236() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(A);
+ return sb.toString();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2017-12-27 00:18:49
|
Revision: 1830
http://sourceforge.net/p/fb-contrib/code/1830
Author: dbrosius
Date: 2017-12-27 00:18:47 +0000 (Wed, 27 Dec 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-12-26 23:49:41 UTC (rev 1829)
+++ trunk/fb-contrib/build.xml 2017-12-27 00:18:47 UTC (rev 1830)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.1.0-SNAPSHOT" />
+ <property name="fb-contrib.version" value="7.2.0" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-12-26 23:49:41 UTC (rev 1829)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-12-27 00:18:47 UTC (rev 1830)
@@ -23,7 +23,7 @@
<!-- Detectors -->
-<!-- COMMENT OUT FOR RELEASE -->
+ <!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
@@ -33,7 +33,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- <!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
@@ -315,9 +315,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.OptionalIssues" speed="fast" reports="OI_OPTIONAL_ISSUES_USES_IMMEDIATE_EXECUTION,OI_OPTIONAL_ISSUES_USES_DELAYED_EXECUTION,OI_OPTIONAL_ISSUES_CHECKING_REFERENCE,OI_OPTIONAL_ISSUES_PRIMITIVE_VARIANT_PREFERRED,OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT,UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"/>
-
- <!-- COMMENT OUT FOR POINT RELEASE -->
-
+
<Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.ReflectionIssues" speed="fast" reports="RFI_SET_ACCESSIBLE"/>
@@ -330,6 +328,7 @@
<!-- COMMENT OUT FOR POINT RELEASE -->
+ <!-- COMMENT OUT FOR POINT RELEASE -->
<!-- BugPattern -->
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2017-12-26 23:49:41 UTC (rev 1829)
+++ trunk/fb-contrib/htdocs/index.shtml 2017-12-27 00:18:47 UTC (rev 1830)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.0.5 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.2.0 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
@@ -77,9 +77,16 @@
</div>
<hr/>
- <img id="git_image" src="flip2.gif" onClick="toggleBlock('git', 'git_image');" align="top"/>
+ <img id="git_image" src="flip1.gif" onClick="toggleBlock('git', 'git_image');" align="top"/>
Detectors added in git<br/>
- <div id="git" style="display:block;">
+ <div id="git" style="display:none;">
+ <ul>
+ </ul>
+ </div>
+ <hr/>
+ <img id="v7_2_0_image" src="flip2.gif" onClick="toggleBlock('v7_2_0', 'v7_2_0_image');" align="top"/>
+ Detectors added in v7.2.0<br/>
+ <div id="v7_2_0" style="display:block;">
<ul>
<li><b>[UTWR] Use Try With Resources</b><br/>
Looks for try/finally blocks that manage resources, without using try-with-resources.
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2017-12-26 23:49:41 UTC (rev 1829)
+++ trunk/fb-contrib/htdocs/repository.html 2017-12-27 00:18:47 UTC (rev 1830)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.0.5 or 7.0.5.sb</td></tr>
+ <tr><td><b>Version:</b></td><td>7.2.0 or 7.2.0.sb</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2017-12-26 23:49:41 UTC (rev 1829)
+++ trunk/fb-contrib/pom.xml 2017-12-27 00:18:47 UTC (rev 1830)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.1.0-SNAPSHOT</version>
+ <version>7.2.0</version>
<!-- TODO: Delete this and replace with enforcer plugin. This is for maven plugins only! Latest maven will through warnings. -->
<prerequisites>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2017-12-26 23:49:47
|
Revision: 1829
http://sourceforge.net/p/fb-contrib/code/1829
Author: dbrosius
Date: 2017-12-26 23:49:41 +0000 (Tue, 26 Dec 2017)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bugrank.txt
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/etc/samples.fbp
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/MethodInfo.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/Statistics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/HangingExecutors.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImmatureClass.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JAXRSIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseAddAll.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseSplit.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseToArray.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseTryWithResources.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WiringIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilder.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/ToString.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/Values.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/XClassUtils.java
trunk/fb-contrib/src/samples/java/ex/COM_Sample.java
trunk/fb-contrib/src/samples/java/ex/HES_Sample.java
trunk/fb-contrib/src/samples/java/ex/LO_Sample.java
trunk/fb-contrib/src/samples/java/ex/MRC_Sample.java
trunk/fb-contrib/src/samples/java/ex/PSC_Sample.java
trunk/fb-contrib/src/samples/java/ex/SEO_Sample.java
trunk/fb-contrib/src/samples/java/ex/SPP_Sample.java
trunk/fb-contrib/src/samples/java/ex/WI_Sample.java
trunk/fb-contrib/yank.xls
Added Paths:
-----------
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectNullableMethodStatus.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MapUsageIssues.java
trunk/fb-contrib/src/samples/java/ex/AI_Sample.java
trunk/fb-contrib/src/samples/java/ex/MUP_Sample.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2017-09-24 01:18:06 UTC (rev 1828)
+++ trunk/fb-contrib/.classpath 2017-12-26 23:49:41 UTC (rev 1829)
@@ -45,5 +45,6 @@
<classpathentry kind="lib" path="lib/javax.ws.rs-api-2.0.1.jar"/>
<classpathentry kind="lib" path="lib/mockito-core-2.8.47.jar" sourcepath="/home/dave/.m2/repository/org/mockito/mockito-core/2.8.47/mockito-core-2.8.47-sources.jar"/>
<classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/>
+ <classpathentry kind="lib" path="lib/log4j-api-2.9.1.jar"/>
<classpathentry kind="output" path="target/classes/main"/>
</classpath>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-09-24 01:18:06 UTC (rev 1828)
+++ trunk/fb-contrib/build.xml 2017-12-26 23:49:41 UTC (rev 1829)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.0.5" />
+ <property name="fb-contrib.version" value="7.1.0-SNAPSHOT" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -42,7 +42,7 @@
<target name="infra_jars" description="pull jars needed to build fb-contrib to ${user.dir}/.ant/lib">
<mkdir dir="${user.home}/.ant/lib" />
- <get src="http://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/1.8.0/yank-1.8.0.jar" dest="${user.home}/.ant/lib"/>
+ <get src="http://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/2.0.0/yank-2.0.0.jar" dest="${user.home}/.ant/lib"/>
<get src="https://bitbucket.org/kjlubick/bugrankcheckstyle/downloads/bug-rank-check-style-1.0.0.jar" dest="${user.home}/.ant/lib"/>
<get src="http://repo1.maven.org/maven2/com/mebigfatguy/vcsversion/vcsversion/0.4.0/vcsversion-0.4.0.jar" dest="${user.home}/.ant/lib"/>
<get src="http://repo1.maven.org/maven2/com/mebigfatguy/fb-delta/fb-delta/0.6.0/fb-delta-0.6.0.jar" dest="${user.home}/.ant/lib" ignoreerrors="true"/>
@@ -103,6 +103,7 @@
<pathelement location="${lib.dir}/bcel-findbugs-${bcel-findbugs.version}.jar" />
<pathelement location="${lib.dir}/findbugs-annotations-${findbugs-annotations.version}.jar" />
<pathelement location="${lib.dir}/asm-debug-all-${asm-debug-all.version}.jar" />
+ <pathelement location="${lib.dir}/jsr305-${jsr305.version}.jar" />
<pathelement location="${main.classes.dir}" />
</path>
<path id="fb-contrib.test.classpath">
@@ -118,9 +119,11 @@
<pathelement location="${lib.dir}/asm-debug-all-${asm-debug-all.version}.jar" />
<pathelement location="${lib.dir}/javax.servlet.jsp-api-${javax.servlet.jsp-api.version}.jar" />
<pathelement location="${lib.dir}/junit-${junit.version}.jar" />
+ <pathelement location="${lib.dir}/jsr305-${jsr305.version}.jar" />
<pathelement location="${lib.dir}/testng-${testng.version}.jar" />
<pathelement location="${lib.dir}/javax.servlet-api-${javax.servlet-api.version}.jar" />
<pathelement location="${lib.dir}/log4j-${log4j.version}.jar" />
+ <pathelement location="${lib.dir}/log4j-api-${log4j-api.version}.jar" />
<pathelement location="${lib.dir}/commons-lang3-${commons-lang3.version}.jar" />
<pathelement location="${lib.dir}/commons-io-${commons-io.version}.jar" />
<pathelement location="${lib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2017-09-24 01:18:06 UTC (rev 1828)
+++ trunk/fb-contrib/etc/bugrank.txt 2017-12-26 23:49:41 UTC (rev 1829)
@@ -3,6 +3,7 @@
+0 BugPattern AFBR_ABNORMAL_FINALLY_BLOCK_RETURN
+0 BugPattern AIOB_ARRAY_INDEX_OUT_OF_BOUNDS
+0 BugPattern AIOB_ARRAY_STORE_TO_NULL_REFERENCE
++1 BugPattern AI_ANNOTATION_ISSUES_NEEDS_NULLABLE
+0 BugPattern AOM_ABSTRACT_OVERRIDDEN_METHOD
+0 BugPattern AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE
+0 BugPattern BAS_BLOATED_ASSIGNMENT_SCOPE
@@ -104,6 +105,7 @@
+0 BugPattern LO_INVALID_FORMATTING_ANCHOR
+0 BugPattern LO_INVALID_STRING_FORMAT_NOTATION
+0 BugPattern LO_LOGGER_LOST_EXCEPTION_STACK_TRACE
++0 BugPattern LO_NON_PRIVATE_STATIC_LOGGER
+0 BugPattern LO_STUTTERED_MESSAGE
+0 BugPattern LO_SUSPECT_LOG_CLASS
+0 BugPattern LO_SUSPECT_LOG_PARAMETER
@@ -129,6 +131,7 @@
+2 BugPattern MOM_MISLEADING_OVERLOAD_MODEL
+0 BugPattern MRC_METHOD_RETURNS_CONSTANT
+0 BugPattern MUC_MODIFYING_UNMODIFIABLE_COLLECTION
++0 BugPattern MUP_CONTAINSKEY_BEFORE_GET
+0 BugPattern NAB_NEEDLESS_AUTOBOXING_CTOR
+0 BugPattern NAB_NEEDLESS_AUTOBOXING_VALUEOF
+0 BugPattern NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION
@@ -282,5 +285,6 @@
+0 BugPattern WEM_OBSCURING_EXCEPTION
+0 BugPattern WEM_WEAK_EXCEPTION_MESSAGING
+0 BugPattern WI_DUPLICATE_WIRED_TYPES
++0 BugPattern WI_MANUALLY_ALLOCATING_AN_AUTOWIRED_BEAN
+0 BugPattern WOC_WRITE_ONLY_COLLECTION_FIELD
+0 BugPattern WOC_WRITE_ONLY_COLLECTION_LOCAL
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-09-24 01:18:06 UTC (rev 1828)
+++ trunk/fb-contrib/etc/findbugs.xml 2017-12-26 23:49:41 UTC (rev 1829)
@@ -15,12 +15,15 @@
<Earlier class="com.mebigfatguy.fbcontrib.collect.CollectMethodsReturningImmutableCollections" />
<LaterCategory name="reporting" spanplugins="true" />
</SplitPass>
-
+ <SplitPass>
+ <Earlier class="com.mebigfatguy.fbcontrib.collect.CollectNullableMethodStatus" />
+ <LaterCategory name="reporting" spanplugins="true" />
+ </SplitPass>
</OrderingConstraints>
<!-- Detectors -->
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
@@ -30,7 +33,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+ <!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
@@ -176,7 +179,7 @@
<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_LOGGER_LOST_EXCEPTION_STACK_TRACE,LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER,LO_STUTTERED_MESSAGE,LO_INVALID_FORMATTING_ANCHOR,LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING,LO_INVALID_STRING_FORMAT_NOTATION,LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING,LO_TOSTRING_PARAMETER" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" speed="fast" reports="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE,LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER,LO_STUTTERED_MESSAGE,LO_INVALID_FORMATTING_ANCHOR,LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS,LO_EXCEPTION_WITH_LOGGER_PARMS,LO_APPENDED_STRING_IN_FORMAT_STRING,LO_INVALID_STRING_FORMAT_NOTATION,LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING,LO_TOSTRING_PARAMETER,LO_NON_PRIVATE_STATIC_LOGGER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" />
@@ -281,7 +284,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ConflatingResourcesAndFiles" speed="fast" reports="CRF_CONFLATING_RESOURCES_AND_FILES" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.OverlyPermissiveMethod" speed="fast" reports="OPM_OVERLY_PERMISSIVE_METHOD" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.OverlyPermissiveMethod" speed="moderate" reports="OPM_OVERLY_PERMISSIVE_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.StringifiedTypes" speed="fast" reports="STT_STRING_PARSING_A_FIELD,STT_TOSTRING_STORED_IN_FIELD,STT_TOSTRING_MAP_KEYING" />
@@ -301,7 +304,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BuryingLogic" speed="fast" reports="BL_BURYING_LOGIC"/>
- <Detector class="com.mebigfatguy.fbcontrib.detect.WiringIssues" speed="fast" reports="WI_DUPLICATE_WIRED_TYPES"/>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.WiringIssues" speed="fast" reports="WI_DUPLICATE_WIRED_TYPES,WI_MANUALLY_ALLOCATING_AN_AUTOWIRED_BEAN"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.ConcurrentCollectionIssues" speed="fast" reports="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY"/>
@@ -313,14 +316,21 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryApiConversion" speed="fast" reports="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT,UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH"/>
- <!-- COMMENT OUT FOR POINT RELEASE
+ <!-- COMMENT OUT FOR POINT RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.UseTryWithResources" speed="fast" reports="UTWR_USE_TRY_WITH_RESOURCES"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.ReflectionIssues" speed="fast" reports="RFI_SET_ACCESSIBLE"/>
- COMMENT OUT FOR POINT RELEASE -->
+ <Detector class="com.mebigfatguy.fbcontrib.detect.AnnotationIssues" speed="fast" reports="AI_ANNOTATION_ISSUES_NEEDS_NULLABLE"/>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.MapUsageIssues" speed="fast" reports="MUP_CONTAINSKEY_BEFORE_GET"/>
+
+ <Detector class="com.mebigfatguy.fbcontrib.collect.CollectNullableMethodStatus" speed="fast" reports="" hidden="true" />
+
+
+ <!-- COMMENT OUT FOR POINT RELEASE -->
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -484,6 +494,7 @@
<BugPattern abbrev="LO" type="LO_INVALID_STRING_FORMAT_NOTATION" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING" category="CORRECTNESS"/>
<BugPattern abbrev="LO" type="LO_TOSTRING_PARAMETER" category="CORRECTNESS" />
+ <BugPattern abbrev="LO" type="LO_NON_PRIVATE_STATIC_LOGGER" 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" />
@@ -594,6 +605,7 @@
<BugPattern abbrev="DMC" type="DMC_DUBIOUS_MAP_COLLECTION" category="CORRECTNESS"/>
<BugPattern abbrev="BL" type="BL_BURYING_LOGIC" category="STYLE"/>
<BugPattern abbrev="WI" type="WI_DUPLICATE_WIRED_TYPES" category="CORRECTNESS"/>
+ <BugPattern abbrev="WI" type="WI_MANUALLY_ALLOCATING_AN_AUTOWIRED_BEAN" category="CORRECTNESS"/>
<BugPattern abbrev="CCI" type="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY" category="CORRECTNESS"/>
<BugPattern abbrev="UTWR" type="UTWR_USE_TRY_WITH_RESOURCES" category="STYLE" experimental="true"/>
<BugPattern abbrev="SSCU" type="SSCU_SUSPICIOUS_SHADED_CLASS_USE" category="CORRECTNESS"/>
@@ -606,4 +618,6 @@
<BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT" category="CORRECTNESS"/>
<BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" category="CORRECTNESS"/>
<BugPattern abbrev="RFI" type="RFI_SET_ACCESSIBLE" category="CORRECTNESS" experimental="true"/>
+ <BugPattern abbrev="AI" type="AI_ANNOTATION_ISSUES_NEEDS_NULLABLE" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="MUP" type="MUP_CONTAINSKEY_BEFORE_GET" category="STYLE" experimental="true" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2017-09-24 01:18:06 UTC (rev 1828)
+++ trunk/fb-contrib/etc/messages.xml 2017-12-26 23:49:41 UTC (rev 1829)
@@ -30,6 +30,14 @@
]]>
</Details>
</Detector>
+
+ <Detector class="com.mebigfatguy.fbcontrib.collect.CollectNullableMethodStatus">
+ <Details>
+ <![CDATA[
+ <p>Collects method calls that can return null</p>
+ ]]>
+ </Details>
+ </Detector>
<Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering">
<Details>
@@ -909,7 +917,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities">
<Details>
<![CDATA[
- <p>Looks for odd patterns of use of Logger classes from either log4j, SLF4J or Commons Logging.</p>
+ <p>Looks for odd patterns of use of Logger classes from either Log4j, Log4j2, SLF4J or Commons Logging.</p>
<p>It is a fast detector.</p>
]]>
</Details>
@@ -1705,7 +1713,25 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.AnnotationIssues">
+ <Details>
+ <![CDATA[
+ <p>Looks for issues around use of standard anntations</p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.MapUsageIssues">
+ <Details>
+ <![CDATA[
+ <p>Looks for dubious usage patterns around the Map interface</p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
+
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger">
<Details></Details>
</Detector>
@@ -4030,8 +4056,8 @@
<LongDescription>Method {1} attempts to log using numbered formatting anchors</LongDescription>
<Details>
<![CDATA[
- <p>This method attempts to use an SLF4J logger to log a parameterized expression using formatting anchors.
- However, SLF4J uses simple non numbered anchors such as {}, rather than anchors with digits in them as the
+ <p>This method attempts to use an SLF4J or Log4j2 logger to log a parameterized expression using formatting anchors.
+ However, SLF4J and Log4j2 use simple non numbered anchors such as {}, rather than anchors with digits in them as the
code uses. Thus no parameter replacement will occur.</p>
<p>This pattern is invalid:
<code>LOGGER.error("{0} is broken", theThing);</code>
@@ -4047,8 +4073,8 @@
<LongDescription>Method {1} attempts to log using String.format notation</LongDescription>
<Details>
<![CDATA[
- <p>This method attempts to use an SLF4J logger to log a parameterized expression using String.format notation.
- However, SLF4J uses simple non numbered anchors such as {}, rather than anchors with percent signs in them as the
+ <p>This method attempts to use an SLF4J or Log4j2 logger to log a parameterized expression using String.format notation.
+ However, SLF4J and Log4j2 uses simple non numbered anchors such as {}, rather than anchors with percent signs in them as the
code uses. Thus no parameter replacement will occur.</p>
<p>This pattern is invalid:
<code>LOGGER.error("%s is broken", theThing);</code>
@@ -4060,11 +4086,11 @@
</BugPattern>
<BugPattern type="LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS">
- <ShortDescription>Method passes an incorrect number of parameters to an SLF4J logging statement</ShortDescription>
- <LongDescription>Method {1} passes an incorrect number of parameters to an SLF4J logging statement</LongDescription>
+ <ShortDescription>Method passes an incorrect number of parameters to an SLF4J or Log4j2 logging statement</ShortDescription>
+ <LongDescription>Method {1} passes an incorrect number of parameters to an SLF4J or Log4j2 logging statement</LongDescription>
<Details>
<![CDATA[
- <p>This method passes the wrong number of parameters to an SLF4J logging method (error, warn, info, debug) based on the number of anchors {} in the
+ <p>This method passes the wrong number of parameters to an SLF4J or Log4j2 logging method (error, warn, info, debug) based on the number of anchors {} in the
format string. An additional exception argument is allowed if found.</p>
]]>
</Details>
@@ -4076,7 +4102,7 @@
<Details>
<![CDATA[
<p>This method passes a standard exception as a logger parameter, and expects this exception to be substituted in
- an SLF4J style parameter marker '{}'. This marker will not be translated as SLF4J doesn't process the Exception
+ an SLF4J or Log4j style parameter marker '{}'. This marker will not be translated as SLF4J or Log4j2 doesn't process the Exception
class for markers.
</p>
]]>
@@ -4084,11 +4110,11 @@
</BugPattern>
<BugPattern type="LO_APPENDED_STRING_IN_FORMAT_STRING">
- <ShortDescription>Method passes a concatenated string to SLF4J's format string</ShortDescription>
- <LongDescription>Method {1} passes a concatenated string to SLF4J's format string</LongDescription>
+ <ShortDescription>Method passes a concatenated string to SLF4J's or Log4j2's format string</ShortDescription>
+ <LongDescription>Method {1} passes a concatenated string to SLF4J's or Log4j2's format string</LongDescription>
<Details>
<![CDATA[
- <p>This method uses an SLF4J logger to log a string, where the first (format) string is created using concatenation.
+ <p>This method uses an SLF4J or Log4j2 logger to log a string, where the first (format) string is created using concatenation.
You should use {} markers to inject dynamic content into the string, so that String building is delayed until the
actual log string is needed. If the log level is high enough that this log statement isn't used, then the appends
will never be executed.</p>
@@ -4098,13 +4124,13 @@
<BugPattern type="LO_EMBEDDED_SIMPLE_STRING_FORMAT_IN_FORMAT_STRING">
- <ShortDescription>Method passes a simple String.format result to an SLF4J's format string</ShortDescription>
- <LongDescription>Method {1} passes a simple String.format result to an SLF4J's format string</LongDescription>
+ <ShortDescription>Method passes a simple String.format result to an SLF4J's or Log4j2's format string</ShortDescription>
+ <LongDescription>Method {1} passes a simple String.format result to an SLF4J's or Log4j2's format string</LongDescription>
<Details>
<![CDATA[
- <p>This method uses an SLF4J logger to log a string, which was produced through a call to String.format, where
+ <p>This method uses an SLF4J or Log4j2 logger to log a string, which was produced through a call to String.format, where
the format string passed was a constant string containing only simple format markers that could be directly handled
- by slf4j. Rather than doing
+ by slf4j or Log4j. Rather than doing
<pre>
logger.error("String.format("This %s is an error", s));
<pre>
@@ -4132,6 +4158,31 @@
</Details>
</BugPattern>
+ <BugPattern type="LO_NON_PRIVATE_STATIC_LOGGER">
+ <ShortDescription>Class defines non private logger using a static class context</ShortDescription>
+ <LongDescription>Class {0} defines a non private logger using a static class context</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This class defines a static logger as non private. It does so by passing the name of a
+ class such as
+ <code><pre>public static final Logger LOG = LoggerFactory.getLogger(Foo.class);</pre></code>
+ Since this class is public it may be used in other classes, but doing so, will provide the incorrect
+ class reference as the class is hard coded.
+ </p>
+ <p>
+ It is recommend to define static loggers as private, and just redefine a new logger in any class
+ that you need to have logging done.
+ <p>
+ <p>If you wish to have a base class define the logger, and have derived classes use that logger, you can
+ potentially use instance based logging, such as
+ <code><pre>protected final Logger LOG = LoggerFactory.getLogger(getClass());</pre></code>
+ However this has the downside of being an instance based logger, and creating a logger object in each instance
+ of the class where it is used.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<BugPattern type="IICU_INCORRECT_INTERNAL_CLASS_USE">
<ShortDescription>Class relies on internal API classes</ShortDescription>
<LongDescription>Class {0} relies on internal API classes</LongDescription>
@@ -5778,6 +5829,19 @@
</Details>
</BugPattern>
+ <BugPattern type="WI_MANUALLY_ALLOCATING_AN_AUTOWIRED_BEAN">
+ <ShortDescription>Method allocates an object with new when the class is defined as an autowireable bean</ShortDescription>
+ <LongDescription>Method {1} allocates an object with new when the class is defined as an autowireable bean</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>this method allocates an object with new, but the class of the object that is being created is marked with a Spring annotation
+ denoting that this class is to be used through an @Autowire annotation. Allocating it with new, will likely mean that fields on the
+ class will not be autowired, but instead be null. You should just autowire an instance of this class into the class in question, or if
+ need be, use spring's getBean(name) method to fetch one.</p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<BugPattern type="CCI_CONCURRENT_COLLECTION_ISSUES_USE_PUT_IS_RACY">
<ShortDescription>Method gets and sets a value of a ConcurrentHashMap in a racy manner</ShortDescription>
<LongDescription>Method {1} gets and sets a value of a ConcurrentHashMap in a racy manner </LongDescription>
@@ -5945,6 +6009,89 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="AI_ANNOTATION_ISSUES_NEEDS_NULLABLE">
+ <ShortDescription>Method that can return null, is missing a @Nullable annotation</ShortDescrip...
[truncated message content] |
|
From: <dbr...@us...> - 2018-03-04 05:43:16
|
Revision: 1832
http://sourceforge.net/p/fb-contrib/code/1832
Author: dbrosius
Date: 2018-03-04 05:43:03 +0000 (Sun, 04 Mar 2018)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bugrank.txt
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/FBContrib.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectMethodsReturningImmutableCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectNullableMethodStatus.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/ImmutabilityType.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/MethodInfo.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/Statistics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/debug/Debug.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractCollectionScanningDetector.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BuryingLogic.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CharsetIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CloneUsability.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConcurrentCollectionIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflatingResourcesAndFiles.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContainsBasedConditional.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DateComparison.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/HangingExecutors.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/HttpClientProblems.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IOIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InvalidConstantArgument.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JAXRSIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LocalTypeDetector.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MapUsageIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ModifyingUnmodifiableCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyPermissiveMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ParallelLists.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorMansEnum.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/RuntimeExceptionDeclared.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/StringifiedTypes.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuboptimalExpressionOrder.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousLoopSearch.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/TailRecursion.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnitTestAssertionOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/Unjitable.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryApiConversion.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnsynchronizedSingletonFieldWrites.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseAddAll.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseSplit.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseToArray.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseTryWithResources.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WiringIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/AttributesUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/CodeByteUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/CollectionUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/FQField.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/FQMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/OpcodeUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/PublicAPI.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/QMethod.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilder.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/StopOpcodeParsingException.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/ToString.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/UnmodifiableList.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/UnmodifiableSet.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/Values.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/XClassUtils.java
trunk/fb-contrib/src/samples/java/ex/AI_Sample.java
trunk/fb-contrib/src/samples/java/ex/OC_Sample.java
trunk/fb-contrib/src/samples/java/ex/PSC_Sample.java
trunk/fb-contrib/src/samples/java/ex/SPP_Sample.java
trunk/fb-contrib/src/samples/java/ex/UEC_Sample.java
trunk/fb-contrib/src/samples/java/ex/UTAO_Sample.java
trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilderTest.java
trunk/fb-contrib/src/test/java/com/mebigfatguy/fbcontrib/utils/SignatureUtilsTest.java
Added Paths:
-----------
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ListUsageIssues.java
trunk/fb-contrib/src/samples/java/ex/LUI_Sample.java
trunk/fb-contrib/src/samples/java/ex/MUI_Sample.java
Removed Paths:
-------------
trunk/fb-contrib/src/samples/java/ex/MUP_Sample.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2017-12-27 00:20:36 UTC (rev 1831)
+++ trunk/fb-contrib/build.xml 2018-03-04 05:43:03 UTC (rev 1832)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.2.0" />
+ <property name="fb-contrib.version" value="7.2.1" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -256,7 +256,7 @@
<target name="javadoc" depends="-init" description="build the javadoc for the project">
<javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" classpathref="fb-contrib.classpath" destdir="${javadoc.dir}" windowtitle="fb-contrib api" access="private">
<doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle>
- <bottom><![CDATA[<i>Copyright © 2005-2017 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom>
+ <bottom><![CDATA[<i>Copyright © 2005-2018 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2017-12-27 00:20:36 UTC (rev 1831)
+++ trunk/fb-contrib/etc/bugrank.txt 2018-03-04 05:43:03 UTC (rev 1832)
@@ -112,6 +112,9 @@
+0 BugPattern LO_TOSTRING_PARAMETER
+2 BugPattern LSC_LITERAL_STRING_COMPARISON
+0 BugPattern LSYC_LOCAL_SYNCHRONIZED_COLLECTION
++0 BugPattern LUI_USE_COLLECTION_ADD
++0 BugPattern LUI_USE_GET0
++0 BugPattern LUI_USE_SINGLETON_LIST
+2 BugPattern MAC_MANUAL_ARRAY_COPY
+0 BugPattern MDM_BIGDECIMAL_EQUALS
+0 BugPattern MDM_INETADDRESS_GETLOCALHOST
@@ -131,7 +134,11 @@
+2 BugPattern MOM_MISLEADING_OVERLOAD_MODEL
+0 BugPattern MRC_METHOD_RETURNS_CONSTANT
+0 BugPattern MUC_MODIFYING_UNMODIFIABLE_COLLECTION
-+0 BugPattern MUP_CONTAINSKEY_BEFORE_GET
++0 BugPattern MUI_CALLING_SIZE_ON_SUBCONTAINER
++0 BugPattern MUI_CONTAINSKEY_BEFORE_GET
++0 BugPattern MUI_GET_BEFORE_REMOVE
++0 BugPattern MUI_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR
++0 BugPattern MUI_USE_CONTAINSKEY
+0 BugPattern NAB_NEEDLESS_AUTOBOXING_CTOR
+0 BugPattern NAB_NEEDLESS_AUTOBOXING_VALUEOF
+0 BugPattern NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION
@@ -168,6 +175,7 @@
+0 BugPattern PME_POOR_MANS_ENUM
+0 BugPattern PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS
+0 BugPattern PSC_PRESIZE_COLLECTIONS
++0 BugPattern PSC_SUBOPTIMAL_COLLECTION_SIZING
+0 BugPattern PUS_POSSIBLE_UNSUSPECTED_SERIALIZATION
+0 BugPattern RFI_SET_ACCESSIBLE
+0 BugPattern ROOM_REFLECTION_ON_OBJECT_METHODS
@@ -210,7 +218,6 @@
+0 BugPattern SPP_NON_USEFUL_TOSTRING
+0 BugPattern SPP_NO_CHAR_SB_CTOR
+0 BugPattern SPP_NULL_BEFORE_INSTANCEOF
-+0 BugPattern SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR
+0 BugPattern SPP_NULL_CHECK_ON_OPTIONAL
+0 BugPattern SPP_SERIALVER_SHOULD_BE_PRIVATE
+0 BugPattern SPP_STATIC_FORMAT_STRING
@@ -224,7 +231,6 @@
+0 BugPattern SPP_USELESS_TERNARY
+0 BugPattern SPP_USE_BIGDECIMAL_STRING_CTOR
+0 BugPattern SPP_USE_CHARAT
-+0 BugPattern SPP_USE_CONTAINSKEY
+0 BugPattern SPP_USE_GET0
+0 BugPattern SPP_USE_GETPROPERTY
+0 BugPattern SPP_USE_ISEMPTY
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2017-12-27 00:20:36 UTC (rev 1831)
+++ trunk/fb-contrib/etc/findbugs.xml 2018-03-04 05:43:03 UTC (rev 1832)
@@ -23,7 +23,7 @@
<!-- Detectors -->
- <!-- COMMENT OUT FOR RELEASE
+ <!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
@@ -148,7 +148,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SCRV_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_TERNARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_SERIALVER_SHOULD_BE_PRIVATE,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_NULL_CHECK_ON_OPTIONAL,SPP_WRONG_COMMONS_TO_STRING_OBJECT,SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR" />
+ 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_TERNARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_SERIALVER_SHOULD_BE_PRIVATE,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_NULL_CHECK_ON_OPTIONAL,SPP_WRONG_COMMONS_TO_STRING_OBJECT" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" />
@@ -264,7 +264,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ModifyingUnmodifiableCollection" speed="fast" reports="MUC_MODIFYING_UNMODIFIABLE_COLLECTION"/>
- <Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS,PSC_SUBOPTIMAL_COLLECTION_SIZING" />
<Detector class="com.mebigfatguy.fbcontrib.detect.ArrayIndexOutOfBounds" speed="fast" reports="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS,AIOB_ARRAY_STORE_TO_NULL_REFERENCE" />
@@ -322,14 +322,17 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AnnotationIssues" speed="fast" reports="AI_ANNOTATION_ISSUES_NEEDS_NULLABLE"/>
- <Detector class="com.mebigfatguy.fbcontrib.detect.MapUsageIssues" speed="fast" reports="MUP_CONTAINSKEY_BEFORE_GET"/>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.MapUsageIssues" speed="fast" reports="MUI_CONTAINSKEY_BEFORE_GET,MUI_GET_BEFORE_REMOVE,MUI_CALLING_SIZE_ON_SUBCONTAINER,MUI_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR,MUI_USE_CONTAINSKEY"/>
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectNullableMethodStatus" speed="fast" reports="" hidden="true" />
- <!-- COMMENT OUT FOR POINT RELEASE -->
- <!-- COMMENT OUT FOR POINT RELEASE -->
+ <!-- COMMENT OUT FOR POINT RELEASE
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ListUsageIssues" speed="fast" reports="LUI_USE_SINGLETON_LIST,LUI_USE_COLLECTION_ADD,LUI_USE_GET0"/>
+
+ COMMENT OUT FOR POINT RELEASE -->
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -422,7 +425,6 @@
<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" />
@@ -441,7 +443,6 @@
<BugPattern abbrev="SPP" type="SPP_STATIC_FORMAT_STRING" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_NULL_CHECK_ON_OPTIONAL" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_WRONG_COMMONS_TO_STRING_OBJECT" category="CORRECTNESS" />
- <BugPattern abbrev="SPP" type="SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR" category="CORRECTNESS" />
<BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" />
<BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" category="STYLE" />
<BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" />
@@ -550,6 +551,7 @@
<BugPattern abbrev="CU" type="CU_CLONE_USABILITY_THROWS" category="STYLE" />
<BugPattern abbrev="CAAL" type="CAAL_CONFUSING_ARRAY_AS_LIST" category="CORRECTNESS" />
<BugPattern abbrev="PSC" type="PSC_PRESIZE_COLLECTIONS" category="PERFORMANCE" />
+ <BugPattern abbrev="PSC" type="PSC_SUBOPTIMAL_COLLECTION_SIZING" category="PERFORMANCE" />
<BugPattern abbrev="UMTP" type="UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER" category="CORRECTNESS" />
<BugPattern abbrev="NPMC" type="NPMC_NON_PRODUCTIVE_METHOD_CALL" category="CORRECTNESS" />
<BugPattern abbrev="AIOB" type="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS" category="CORRECTNESS" />
@@ -618,5 +620,12 @@
<BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" category="CORRECTNESS"/>
<BugPattern abbrev="RFI" type="RFI_SET_ACCESSIBLE" category="CORRECTNESS" experimental="true"/>
<BugPattern abbrev="AI" type="AI_ANNOTATION_ISSUES_NEEDS_NULLABLE" category="CORRECTNESS" experimental="true" />
- <BugPattern abbrev="MUP" type="MUP_CONTAINSKEY_BEFORE_GET" category="STYLE" experimental="true" />
+ <BugPattern abbrev="MUI" type="MUI_CONTAINSKEY_BEFORE_GET" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="MUI" type="MUI_GET_BEFORE_REMOVE" category="CORRECTNESS"/>
+ <BugPattern abbrev="MUI" type="MUI_CALLING_SIZE_ON_SUBCONTAINER" category="CORRECTNESS" />
+ <BugPattern abbrev="MUI" type="MUI_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR" category="CORRECTNESS" />
+ <BugPattern abbrev="MUI" type="MUI_USE_CONTAINSKEY" category="CORRECTNESS" />
+ <BugPattern abbrev="LUI" type="LUI_USE_SINGLETON_LIST" category="CORRECTNESS" />
+ <BugPattern abbrev="LUI" type="LUI_USE_COLLECTION_ADD" category="CORRECTNESS" />
+ <BugPattern abbrev="LUI" type="LUI_USE_GET0" category="CORRECTNESS" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2017-12-27 00:20:36 UTC (rev 1831)
+++ trunk/fb-contrib/etc/messages.xml 2018-03-04 05:43:03 UTC (rev 1832)
@@ -1731,7 +1731,16 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ListUsageIssues">
+ <Details>
+ <![CDATA[
+ <p>Looks for dubious usage patterns around the List interface</p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger">
<Details></Details>
</Detector>
@@ -3221,7 +3230,7 @@
</Details>
</BugPattern>
- <BugPattern type="SPP_USE_CONTAINSKEY">
+ <BugPattern type="MUI_USE_CONTAINSKEY">
<ShortDescription>Method calls keySet() just to call contains, use containsKey instead</ShortDescription>
<LongDescription>Method {1} calls keySet() just to call contains, use containsKey instead</LongDescription>
<Details>
@@ -3490,7 +3499,7 @@
</Details>
</BugPattern>
- <BugPattern type="SPP_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR">
+ <BugPattern type="MUI_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR">
<ShortDescription>Method checks whether the keySet(), entrySet() or values() collection of a Map is null</ShortDescription>
<LongDescription>Method {1} checks whether the keySet(), entrySet() or values() collection of a Map is null</LongDescription>
<Details>
@@ -4957,6 +4966,28 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="PSC_SUBOPTIMAL_COLLECTION_SIZING">
+ <ShortDescription>Method uses suboptimal sizing to allocation a collection</ShortDescription>
+ <LongDescription>Method {1} uses suboptimal sizing to allocation a collection</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method allocates a collection using the a constructor that takes a size parameter. However,
+ because Maps and Sets have a loading factor, passing in the exact size you want is an
+ incorrect way to presize the collection, and may still cause reallocations. Since you are using
+ Guava, it is better to use
+ <code><pre>
+ ...
[truncated message content] |
|
From: <dbr...@us...> - 2018-05-11 03:30:50
|
Revision: 1834
http://sourceforge.net/p/fb-contrib/code/1834
Author: dbrosius
Date: 2018-05-11 03:29:38 +0000 (Fri, 11 May 2018)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bugrank.txt
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ConflictingTimeUnits.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousMapCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FindClassCircularDependencies.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/HttpClientProblems.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ListUsageIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MapUsageIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MissingMethodsDetector.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PoorMansEnum.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousShadedClassUse.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UnitTestAssertionOddities.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WiringIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/BugType.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/ToString.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/Values.java
trunk/fb-contrib/src/samples/java/ex/AI_Sample.java
trunk/fb-contrib/src/samples/java/ex/LO_Sample.java
trunk/fb-contrib/src/samples/java/ex/MRC_Sample.java
trunk/fb-contrib/src/samples/java/ex/OCP_Sample.java
trunk/fb-contrib/src/samples/java/ex/PMB_Sample.java
trunk/fb-contrib/src/samples/java/ex/PRMC_Sample.java
trunk/fb-contrib/src/samples/java/ex/PSC_Sample.java
trunk/fb-contrib/src/samples/java/ex/SEO_Sample.java
trunk/fb-contrib/src/samples/java/ex/SPP_Sample.java
Added Paths:
-----------
trunk/fb-contrib/etc/pmd-rules.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FunctionalInterfaceIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SetUsageIssues.java
trunk/fb-contrib/src/samples/java/ex/FII_Sample.java
trunk/fb-contrib/src/samples/java/ex/SUI_Sample.java
trunk/fb-contrib/src/samples/java/ex/ce/
trunk/fb-contrib/src/samples/java/ex/ce/CE_Sample.java
trunk/fb-contrib/src/samples/java/ex/ce/Envy.java
Removed Paths:
-------------
trunk/fb-contrib/src/samples/java/ex/CE_Sample.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2018-03-04 05:49:10 UTC (rev 1833)
+++ trunk/fb-contrib/build.xml 2018-05-11 03:29:38 UTC (rev 1834)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.2.1" />
+ <property name="fb-contrib.version" value="7.2.2-SNAPSHOT" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2018-03-04 05:49:10 UTC (rev 1833)
+++ trunk/fb-contrib/etc/bugrank.txt 2018-05-11 03:29:38 UTC (rev 1834)
@@ -53,6 +53,13 @@
+0 BugPattern EXS_EXCEPTION_SOFTENING_RETURN_FALSE
+0 BugPattern FCBL_FIELD_COULD_BE_LOCAL
+2 BugPattern FCCD_FIND_CLASS_CIRCULAR_DEPENDENCY
++0 BugPattern FII_AVOID_CONTAINS_ON_COLLECTED_STREAM
++0 BugPattern FII_AVOID_SIZE_ON_COLLECTED_STREAM
++0 BugPattern FII_COMBINE_FILTERS
++1 BugPattern FII_USE_ANY_MATCH
++0 BugPattern FII_USE_FIND_FIRST
++0 BugPattern FII_USE_FUNCTION_IDENTITY
++0 BugPattern FII_USE_METHOD_REFERENCE
+0 BugPattern FPL_FLOATING_POINT_LOOPS
+6 BugPattern FP_FINAL_PARAMETERS
+0 BugPattern HCP_HTTP_REQUEST_RESOURCES_NOT_FREED_FIELD
@@ -218,7 +225,6 @@
+0 BugPattern SPP_NON_USEFUL_TOSTRING
+0 BugPattern SPP_NO_CHAR_SB_CTOR
+0 BugPattern SPP_NULL_BEFORE_INSTANCEOF
-+0 BugPattern SPP_NULL_CHECK_ON_OPTIONAL
+0 BugPattern SPP_SERIALVER_SHOULD_BE_PRIVATE
+0 BugPattern SPP_STATIC_FORMAT_STRING
+0 BugPattern SPP_STRINGBUFFER_WITH_EMPTY_STRING
@@ -237,6 +243,7 @@
+0 BugPattern SPP_USE_ISNAN
+0 BugPattern SPP_USE_MATH_CONSTANT
+0 BugPattern SPP_USE_STRINGBUILDER_LENGTH
++0 BugPattern SPP_USE_ZERO_WITH_COMPARATOR
+0 BugPattern SPP_WRONG_COMMONS_TO_STRING_OBJECT
+0 BugPattern SSCU_SUSPICIOUS_SHADED_CLASS_USE
+0 BugPattern STB_STACKED_TRY_BLOCKS
@@ -245,6 +252,8 @@
+0 BugPattern STT_TOSTRING_MAP_KEYING
+0 BugPattern STT_TOSTRING_STORED_IN_FIELD
+0 BugPattern SUA_SUSPICIOUS_UNINITIALIZED_ARRAY
++0 BugPattern SUI_CONTAINS_BEFORE_ADD
++0 BugPattern SUI_CONTAINS_BEFORE_REMOVE
+0 BugPattern SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT
+0 BugPattern TBP_TRISTATE_BOOLEAN_PATTERN
+0 BugPattern TR_TAIL_RECURSION
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2018-03-04 05:49:10 UTC (rev 1833)
+++ trunk/fb-contrib/etc/findbugs.xml 2018-05-11 03:29:38 UTC (rev 1834)
@@ -23,17 +23,15 @@
<!-- Detectors -->
- <!-- COMMENT OUT FOR RELEASE
+ <!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
- <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
-
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+ <!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
@@ -148,7 +146,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SCRV_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_TERNARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_SERIALVER_SHOULD_BE_PRIVATE,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_NULL_CHECK_ON_OPTIONAL,SPP_WRONG_COMMONS_TO_STRING_OBJECT" />
+ 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_TERNARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_SERIALVER_SHOULD_BE_PRIVATE,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF,SPP_NON_USEFUL_TOSTRING,SPP_TOSTRING_ON_STRING,SPP_EQUALS_ON_STRING_BUILDER,SPP_CONVERSION_OF_STRING_LITERAL,SPP_STATIC_FORMAT_STRING,SPP_WRONG_COMMONS_TO_STRING_OBJECT,SPP_USE_ZERO_WITH_COMPARATOR" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" />
@@ -327,12 +325,18 @@
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectNullableMethodStatus" speed="fast" reports="" hidden="true" />
- <!-- COMMENT OUT FOR POINT RELEASE
+ <!-- COMMENT OUT FOR POINT RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ListUsageIssues" speed="fast" reports="LUI_USE_SINGLETON_LIST,LUI_USE_COLLECTION_ADD,LUI_USE_GET0"/>
- COMMENT OUT FOR POINT RELEASE -->
+ <Detector class="com.mebigfatguy.fbcontrib.detect.FunctionalInterfaceIssues" speed="fast" reports="FII_USE_METHOD_REFERENCE,FII_AVOID_CONTAINS_ON_COLLECTED_STREAM,FII_USE_ANY_MATCH,FII_USE_FIND_FIRST,FII_COMBINE_FILTERS,FII_USE_FUNCTION_IDENTITY,FII_AVOID_SIZE_ON_COLLECTED_STREAM" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.SetUsageIssues" speed="fast" reports="SUI_CONTAINS_BEFORE_ADD,SUI_CONTAINS_BEFORE_REMOVE"/>
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="slow" reports="CE_CLASS_ENVY" />
+
+ <!-- COMMENT OUT FOR POINT RELEASE -->
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -441,8 +445,8 @@
<BugPattern abbrev="SPP" type="SPP_EQUALS_ON_STRING_BUILDER" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_CONVERSION_OF_STRING_LITERAL" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_STATIC_FORMAT_STRING" category="CORRECTNESS" />
- <BugPattern abbrev="SPP" type="SPP_NULL_CHECK_ON_OPTIONAL" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_WRONG_COMMONS_TO_STRING_OBJECT" category="CORRECTNESS" />
+ <BugPattern abbrev="SPP" type="SPP_USE_ZERO_WITH_COMPARATOR" category="CORRECTNESS" />
<BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" />
<BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" category="STYLE" />
<BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" />
@@ -618,14 +622,23 @@
<BugPattern abbrev="OI" type="OI_OPTIONAL_ISSUES_USES_ORELSEGET_WITH_NULL" category="CORRECTNESS" />
<BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_DATE_TO_INSTANT" category="CORRECTNESS"/>
<BugPattern abbrev="UAC" type="UAC_UNNECESSARY_API_CONVERSION_FILE_TO_PATH" category="CORRECTNESS"/>
- <BugPattern abbrev="RFI" type="RFI_SET_ACCESSIBLE" category="CORRECTNESS" experimental="true"/>
- <BugPattern abbrev="AI" type="AI_ANNOTATION_ISSUES_NEEDS_NULLABLE" category="CORRECTNESS" experimental="true" />
- <BugPattern abbrev="MUI" type="MUI_CONTAINSKEY_BEFORE_GET" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="RFI" type="RFI_SET_ACCESSIBLE" category="CORRECTNESS"/>
+ <BugPattern abbrev="AI" type="AI_ANNOTATION_ISSUES_NEEDS_NULLABLE" category="CORRECTNESS"/>
+ <BugPattern abbrev="MUI" type="MUI_CONTAINSKEY_BEFORE_GET" category="CORRECTNESS"/>
<BugPattern abbrev="MUI" type="MUI_GET_BEFORE_REMOVE" category="CORRECTNESS"/>
<BugPattern abbrev="MUI" type="MUI_CALLING_SIZE_ON_SUBCONTAINER" category="CORRECTNESS" />
<BugPattern abbrev="MUI" type="MUI_NULL_CHECK_ON_MAP_SUBSET_ACCESSOR" category="CORRECTNESS" />
<BugPattern abbrev="MUI" type="MUI_USE_CONTAINSKEY" category="CORRECTNESS" />
- <BugPattern abbrev="LUI" type="LUI_USE_SINGLETON_LIST" category="CORRECTNESS" />
- <BugPattern abbrev="LUI" type="LUI_USE_COLLECTION_ADD" category="CORRECTNESS" />
- <BugPattern abbrev="LUI" type="LUI_USE_GET0" category="CORRECTNESS" />
+ <BugPattern abbrev="LUI" type="LUI_USE_SINGLETON_LIST" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="LUI" type="LUI_USE_COLLECTION_ADD" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="LUI" type="LUI_USE_GET0" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="FII" type="FII_USE_METHOD_REFERENCE" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="FII" type="FII_AVOID_CONTAINS_ON_COLLECTED_STREAM" category="CORRECTNESS" experimental="true "/>
+ <BugPattern abbrev="FII" type="FII_USE_ANY_MATCH" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="FII" type="FII_USE_FIND_FIRST" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="FII" type="FII_COMBINE_FILTERS" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="FII" type="FII_USE_FUNCTION_IDENTITY" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="FII" type="FII_AVOID_SIZE_ON_COLLECTED_STREAM" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="SUI" type="SUI_CONTAINS_BEFORE_ADD" category="CORRECTNESS" experimental="true" />
+ <BugPattern abbrev="SUI" type="SUI_CONTAINS_BEFORE_REMOVE" category="CORRECTNESS" experimental="true" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2018-03-04 05:49:10 UTC (rev 1833)
+++ trunk/fb-contrib/etc/messages.xml 2018-05-11 03:29:38 UTC (rev 1834)
@@ -22,7 +22,7 @@
]]>
</Details>
</Detector>
-
+
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectMethodsReturningImmutableCollections">
<Details>
<![CDATA[
@@ -30,7 +30,7 @@
]]>
</Details>
</Detector>
-
+
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectNullableMethodStatus">
<Details>
<![CDATA[
@@ -62,7 +62,7 @@
<![CDATA[
<p>Looks for use of iterators on synchronized collections built from the java.util.Collections class.</p>
<p>As the collection in question was built through Collections.synchronizedXXX, an assumption
- is made that this collection must be multithreaded safe. However, iterator access is used,
+ is made that this collection must be multithreading safe. However, iterator access is used,
which is explicitly unsafe. When iterators are to be used, synchronization should be done manually.</p>
<p>It is a slow detector.</p>
]]>
@@ -82,7 +82,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.OverlyConcreteParameter">
<Details>
<![CDATA[
- <p>Looks for parameters that are defined by classes, but where the method only use methods defined by an
+ <p>Looks for parameters that are defined by classes, but where the method only uses methods defined by an
implemented interface or superclass of that class. Relying on concrete classes in public signatures causes cohesion,
and makes low impact changes more difficult.</p>
<p>It is a slow detector.</p>
@@ -108,7 +108,7 @@
interface inheritance other than java.lang.Object. Doing so makes for brittle code,
relying either on positional correspondence for type, or a reliance on instanceof to
determine type. A better design usually can be had by creating a separate class,
- which defines the different types required, and add an instance of that class to the
+ which defines the different types required, and adding an instance of that class to the
collection, or array.</p>
<p>It is a fast detector.</p>
]]>
@@ -129,7 +129,7 @@
}
</code>
But what does that tell you? Is this method very very likely to throw NullPointerExceptions?
- If it is, why isn't this method handling them so that exceptions aren't thrown. So don't do this.
+ If it is, why isn't this method handling them so that exceptions aren't thrown? So don't do this.
If an NPE is very likely, then check for it, and handle the situation.
</p>
]]>
@@ -139,12 +139,11 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy">
<Details>
<![CDATA[
- <p><em>THIS DETECTOR IS HIGHLY EXPERIMENTAL AND IS LIKELY TO CREATE A LOT OF FUD</em></p>
- <p>Looks for methods that use a high percentage of methods from another class over its own
+ <p>Looks for methods that use a high percentage of methods from another class over their class' own
methods. When this is the case, it is often better to implement this method in that other class,
by refactoring the class to accept parameters it needs from the source class.
The reporting percentage can be set with system property 'fb-contrib.ce.percent'.</p>
- <p>It is a fast detector.</p>
+ <p>It is a slow detector.</p>
]]>
</Details>
</Detector>
@@ -189,7 +188,7 @@
<![CDATA[
<p>Looks for classes that maintain two or more lists or arrays associated one-for-one through the same index
to hold two or more pieces of related information. It would be better to create a new class that holds
- all of these pieces of information, and place instances of this class in one list. Or if the two list are
+ all of these pieces of information, and place instances of this class in one list. Or if the two lists are
related in key/value fashion, then use a map instead.</p>
<p>It is a fast detector.</p>
]]>
@@ -199,7 +198,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.FinalParameters">
<Details>
<![CDATA[
- <p>Looks for methods that correctly do not write to a parameter. To help document this you should consider
+ <p>Looks for methods that correctly do not write to a parameter. To help document this, you should consider
defining these parameters as final.</p>
<p>It is a slow detector.</p>
]]>
@@ -210,7 +209,7 @@
<Details>
<![CDATA[
<p>Looks for abstract classes that define empty methods or methods that simply throw an
- exception. Since this is an abstract class, it may be cleaner to simple define this method
+ exception. Since this is an abstract class, it may be cleaner to simply define this method
as abstract, so that correct subclass behavior is enforced.</p>
<p>It is a fast detector.</p>
]]>
@@ -232,7 +231,7 @@
<![CDATA[
<p>Looks for methods that use floating point indexes for loops. Since floating point
math is imprecise, rounding errors will occur each time through the loop causing
- hard to find problems. It is usually better to use integer indexing, and calculating
+ hard-to-find problems. It is usually better to use integer indexing, and calculate
the correct floating point value from the index.</p>
<p>It is a fast detector.</p>
]]>
@@ -276,7 +275,7 @@
<pre><code>
public void test(Character c)
</code></pre>
- but instead maps to one that takes an int, long, float or double, such as
+ but it instead maps to one that takes an int, long, float or double, such as
<pre><code>
public void test(int i)
</code></pre>
@@ -384,7 +383,7 @@
<Details>
<![CDATA[
<p>Looks for methods that create DOM nodes but do not add them to any DOM Document.
- Either the node was needed to be added to the tree, or the node likely was created in error.</p>
+ Either the node needed to be added to the tree, or the node likely was created in error.</p>
<p>It is a fast detector.</p>
]]>
</Details>
@@ -404,7 +403,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML">
<Details>
<![CDATA[
- <p>Looks for methods that build XML based strings by concatenation strings
+ <p>Looks for methods that build XML based strings by concatenating strings
and custom values together. Doing so makes brittle code, that is difficult to
modify, validate and understand. It is cleaner to create external XML files that are
transformed at runtime, using parameters set through Transformer.setParameter.</p>
@@ -430,7 +429,7 @@
<p>Looks for methods that access arrays or classes that implement java.util.List
using a constant integer for the index. This is often a typo intended to be a loop
variable, but if specific indices mean certain things, perhaps a first class object
- would be a better choice for a container, on even a map with informative key names
+ would be a better choice for a container, or even a map with informative key names
would be better.</p>
<p>It is a fast detector.</p>
]]>
@@ -540,7 +539,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.FieldCouldBeLocal">
<Details>
<![CDATA[
- <p>Looks for classes that define fields that are used in a locals only fashion,
+ <p>Looks for classes that define fields that are used in a local-only fashion,
specifically private fields that are accessed first in each method with a
store vs. a load.</p>
<p>It is a slow detector.</p>
@@ -574,7 +573,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.Section508Compliance">
<Details>
<![CDATA[
- <p>Looks for violation of Section 508, Accessibility for People with disabilities Act.</p>
+ <p>Looks for violation of Section 508, Accessibility for People with Disabilities Act.</p>
<p>It is a fast detector.</p>
]]>
</Details>
@@ -679,7 +678,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.TailRecursion">
<Details>
<![CDATA[
- <p>Looks for methods that make a recursive call to itself as the last statement in the
+ <p>Looks for methods that make recursive calls to themselves as the last statement in the
method. This tail recursion could be converted into a simple loop which would improve
the performance and stack requirements.</p>
<p>It is a fast detector.</p>
@@ -704,7 +703,7 @@
<![CDATA[
<p>Looks for classes that don't handle serialization of parent class member fields
when the class in question is serializable but is derived from a non serializable
- classes.</p>
+ class.</p>
<p>It is a fast detector.</p>
]]>
</Details>
@@ -714,7 +713,7 @@
<Details>
<![CDATA[
<p>Looks for classes that implement Comparator or Comparable, and whose compare or compareTo
- methods return constant values only, but that don't represent the three possible choice
+ methods return constant values only, but that don't represent the three possible choices
(a negative number, 0, and a positive number).</p>
<p>It is a fast detector.</p>
]]>
@@ -734,7 +733,7 @@
<Details>
<![CDATA[
<p><em>THIS DETECTOR IS HIGHLY EXPERIMENTAL AND IS LIKELY TO CREATE A LOT OF FUD</em></p>
- <p>Looks for assignments to variables in a scope larger than its use. As long as the evaluation of the assignment
+ <p>Looks for assignments to variables in a scope larger than their use. As long as the evaluation of the assignment
does not have side effects, the assignment can be moved into the inner scope where it is used.</p>
<p>It is a fast detector.</p>
]]>
@@ -868,7 +867,7 @@
<Details>
<![CDATA[
<p>Looks for JUnit or TestNG test case methods that use assertions with odd parameters.
- Including in this is:
+ Included in this is:
<ul>
<li>Passing a constant as the second (actual) parameter in a JUnit test</li>
<li>Not using the three parameter version of asserts for doubles</li>
@@ -1105,7 +1104,7 @@
<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 reassigns that
+ before entering a code block - either an if, or while statement - and then reassigns that
field or local variable. It is likely that guard should have been to see if that
field or local variable is null, not, not null.</p>
<p>It is a fast detector.</p>
@@ -1195,7 +1194,7 @@
<![CDATA[
<p>This detector looks for object creation where the object isn't assigned to any variable or
field. This implies that the class operates through side effects in the constructor, which makes
- for difficult to maintain code.</p>
+ for difficult-to-maintain code.</p>
<p>It is a fast detector.</p>
]]>
</Details>
@@ -1205,7 +1204,7 @@
<Details>
<![CDATA[
<p>This detector looks for Java bean getter-setter use where the value of a property is set
- with the value retrieved from the same bean's correllary getter, like this:</p>
+ with the value retrieved from the same bean's corollary getter, like this:</p>
<pre><code>
person.setAge(person.getAge());
</code></pre>
@@ -1218,7 +1217,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects">
<Details>
<![CDATA[
- <p>This detector looks for creation of java.awt.Graphics object that do not have the
+ <p>This detector looks for creation of java.awt.Graphics objects that do not have the
<code>.dispose()</code> method called on them when finished. These objects will be cleaned up by
the Garbage collector, bug given the likelihood that large numbers of these objects can
be created in a short period of time, it is better to dispose them as soon as possible.</p>
@@ -1230,7 +1229,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks">
<Details>
<![CDATA[
- <p>This detector looks for two or more try catch blocks that are consecutive
+ <p>This detector looks for two or more try-catch blocks that are consecutive
and catch the same kind of exception, and each catch block mandatorily throws
the same exception. These two catch blocks can and should be made into one
catch block to simply the code.</p>
@@ -1263,7 +1262,7 @@
<Details>
<![CDATA[
<p>This detector looks for uses for commons-lang <code>ToStringBuilder</code> where the
- result of <code>toString()</code> is returned without an intermediate invocation of toString().</p>
+ result of <code>toString()</code> is returned without an intermediate invocation of append().</p>
<p>It is a fast detector.</p>
]]>
</Details>
@@ -1378,7 +1377,7 @@
]]>
</Details>
</Detector>
-
+
<Detector class="com.mebigfatguy.fbcontrib.detect.CollectionNamingConfusion">
<Details>
<![CDATA[
@@ -1390,11 +1389,11 @@
]]>
</Details>
</Detector>
-
+
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorMansEnum">
<Details>
<![CDATA[
- <p>Looks for fields defined with simple types, (int, String, etc) that are used like an enum. Specifically fields that are
+ <p>Looks for fields defined with simple types, (int, String, etc) that are used like enums. Specifically fields that are
only assigned a set of constant values. This variable probably should be redefined as an enum.
</p>
<p>It is a fast detector.</p>
@@ -1401,26 +1400,26 @@
]]>
</Details>
</Detector>
-
+
<Detector class="com.mebigfatguy.fbcontrib.detect.UnusedParameter">
<Details>
<![CDATA[
<p>Looks for private or static methods that have parameters that aren't used. These parameters
can be removed, assuming the method isn't used through reflection.</p>
- <p>It is fast detector.</p>
+ <p>It is a fast detector.</p>
]]>
</Details>
</Detector>
-
+
<Detector class="com.mebigfatguy.fbcontrib.detect.FindClassCircularDependencies">
<Details>
<![CDATA[
- <p>This detector looks circular dependencies among classes. </p>
+ <p>This detector looks for circular dependencies among classes. </p>
<p>It is a moderately fast detector.</p>
]]>
</Details>
</Detector>
-
+
<Detector class="com.mebigfatguy.fbcontrib.detect.ModifyingUnmodifiableCollection">
<Details>
<![CDATA[
@@ -1440,7 +1439,7 @@
]]>
</Details>
</Detector>
-
+
<Detector class="com.mebigfatguy.fbcontrib.detect.HttpClientProblems">
<Details>
<![CDATA[
@@ -1450,7 +1449,7 @@
]]>
</Details>
</Detector>
-
+
<Detector class="com.mebigfatguy.fbcontrib.detect.Unjitab...
[truncated message content] |
|
From: <dbr...@us...> - 2018-05-12 02:20:45
|
Revision: 1835
http://sourceforge.net/p/fb-contrib/code/1835
Author: dbrosius
Date: 2018-05-12 02:20:43 +0000 (Sat, 12 May 2018)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2018-05-11 03:29:38 UTC (rev 1834)
+++ trunk/fb-contrib/build.xml 2018-05-12 02:20:43 UTC (rev 1835)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.2.2-SNAPSHOT" />
+ <property name="fb-contrib.version" value="7.4.0" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2018-05-11 03:29:38 UTC (rev 1834)
+++ trunk/fb-contrib/etc/findbugs.xml 2018-05-12 02:20:43 UTC (rev 1835)
@@ -23,7 +23,7 @@
<!-- Detectors -->
- <!-- COMMENT OUT FOR RELEASE -->
+ <!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
@@ -31,7 +31,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- <!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
@@ -324,9 +324,6 @@
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectNullableMethodStatus" speed="fast" reports="" hidden="true" />
-
- <!-- COMMENT OUT FOR POINT RELEASE -->
-
<Detector class="com.mebigfatguy.fbcontrib.detect.ListUsageIssues" speed="fast" reports="LUI_USE_SINGLETON_LIST,LUI_USE_COLLECTION_ADD,LUI_USE_GET0"/>
<Detector class="com.mebigfatguy.fbcontrib.detect.FunctionalInterfaceIssues" speed="fast" reports="FII_USE_METHOD_REFERENCE,FII_AVOID_CONTAINS_ON_COLLECTED_STREAM,FII_USE_ANY_MATCH,FII_USE_FIND_FIRST,FII_COMBINE_FILTERS,FII_USE_FUNCTION_IDENTITY,FII_AVOID_SIZE_ON_COLLECTED_STREAM" />
@@ -336,6 +333,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="slow" reports="CE_CLASS_ENVY" />
<!-- COMMENT OUT FOR POINT RELEASE -->
+ <!-- COMMENT OUT FOR POINT RELEASE -->
<!-- BugPattern -->
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2018-05-11 03:29:38 UTC (rev 1834)
+++ trunk/fb-contrib/htdocs/index.shtml 2018-05-12 02:20:43 UTC (rev 1835)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.2.1 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.4.0 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
@@ -75,11 +75,17 @@
github. If this site seems behind, please <a href="http://github.com/mebigfatguy/fb-contrib">check there</a>.
I will try to keep this site up to date, but I'd appreciate a poke if you see something missing.</p>
</div>
-
+ <hr/>
+ <img id="git_image" src="flip1.gif" onClick="toggleBlock('git', 'git_image');" align="top"/>
+ Detectors added in git<br/>
+ <div id="git" style="display:none;">
+ <ul>
+ </ul>
+ </div>
<hr/>
- <img id="git_image" src="flip2.gif" onClick="toggleBlock('git', 'git_image');" align="top"/>
- Detectors added in git<br/>
- <div id="git" style="display:block;">
+ <img id="v7_4_0_image" src="flip2.gif" onClick="toggleBlock('v7_4_0', 'v7_4_0_image');" align="top"/>
+ Detectors added in v7.4.0<br/>
+ <div id="v7_4_0" style="display:block;">
<ul>
<li><b>[LUI] List Usage Issues</b><br/>
Looks for odd usage patterns when using Lists
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2018-05-11 03:29:38 UTC (rev 1834)
+++ trunk/fb-contrib/htdocs/repository.html 2018-05-12 02:20:43 UTC (rev 1835)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.2.1 or 7.2.1.sb</td></tr>
+ <tr><td><b>Version:</b></td><td>7.4.0 or 7.4.0.sb</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2018-05-11 03:29:38 UTC (rev 1834)
+++ trunk/fb-contrib/pom.xml 2018-05-12 02:20:43 UTC (rev 1835)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.2.2-SNAPSHOT</version>
+ <version>7.4.0</version>
<!-- TODO: Delete this and replace with enforcer plugin. This is for maven plugins only! Latest maven will through warnings. -->
<prerequisites>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2018-05-20 21:58:42
|
Revision: 1837
http://sourceforge.net/p/fb-contrib/code/1837
Author: dbrosius
Date: 2018-05-20 21:58:38 +0000 (Sun, 20 May 2018)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FunctionalInterfaceIssues.java
trunk/fb-contrib/src/samples/java/ex/AI_Sample.java
trunk/fb-contrib/src/samples/java/ex/FII_Sample.java
trunk/fb-contrib/yank.xls
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2018-05-12 02:22:28 UTC (rev 1836)
+++ trunk/fb-contrib/build.xml 2018-05-20 21:58:38 UTC (rev 1837)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.4.0" />
+ <property name="fb-contrib.version" value="7.4.1" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -109,7 +109,9 @@
<path id="fb-contrib.test.classpath">
<pathelement location="${lib.dir}/testng-${testng.version}.jar" />
<pathelement location="${lib.dir}/jcommander-${jcommander.version}.jar" />
- <pathelement location="${lib.dir}/mockito-core-${mockito-core.version}.jar" />
+ <pathelement location="${lib.dir}/mockito-core-${mockito-core.version}.jar" />
+ <pathelement location="${lib.dir}/byte-buddy-${byte-buddy.version}.jar" />
+ <pathelement location="${lib.dir}/objenesis-${objenesis.version}.jar" />
<pathelement location="${lib.dir}/hamcrest-core-${hamcrest-core.version}.jar" />
<pathelement location="${findbugs.dir}/lib/dom4j-1.6.1.jar" />
<pathelement location="${findbugs.dir}/lib/jaxen-1.1.6.jar" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2018-05-12 02:22:28 UTC (rev 1836)
+++ trunk/fb-contrib/etc/findbugs.xml 2018-05-20 21:58:38 UTC (rev 1837)
@@ -31,7 +31,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2018-05-12 02:22:28 UTC (rev 1836)
+++ trunk/fb-contrib/htdocs/index.shtml 2018-05-20 21:58:38 UTC (rev 1837)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.4.0 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.4.1 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2018-05-12 02:22:28 UTC (rev 1836)
+++ trunk/fb-contrib/htdocs/repository.html 2018-05-20 21:58:38 UTC (rev 1837)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.4.0 or 7.4.0.sb</td></tr>
+ <tr><td><b>Version:</b></td><td>7.4.1 or 7.4.1.sb</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2018-05-12 02:22:28 UTC (rev 1836)
+++ trunk/fb-contrib/pom.xml 2018-05-20 21:58:38 UTC (rev 1837)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.4.0</version>
+ <version>7.4.1</version>
<!-- TODO: Delete this and replace with enforcer plugin. This is for maven plugins only! Latest maven will through warnings. -->
<prerequisites>
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java 2018-05-12 02:22:28 UTC (rev 1836)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java 2018-05-20 21:58:38 UTC (rev 1837)
@@ -33,7 +33,10 @@
import com.mebigfatguy.fbcontrib.collect.MethodInfo;
import com.mebigfatguy.fbcontrib.collect.Statistics;
import com.mebigfatguy.fbcontrib.utils.BugType;
+import com.mebigfatguy.fbcontrib.utils.FQMethod;
+import com.mebigfatguy.fbcontrib.utils.SignatureBuilder;
import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException;
+import com.mebigfatguy.fbcontrib.utils.UnmodifiableSet;
import com.mebigfatguy.fbcontrib.utils.Values;
import edu.umd.cs.findbugs.BugInstance;
@@ -73,6 +76,12 @@
}
}
+ private static final Set<FQMethod> NOTABLE_EXCEPTIONS = UnmodifiableSet.create(
+ // @formatter:off
+ new FQMethod(Values.SLASHED_JAVA_LANG_CLASS, "newInstance", SignatureBuilder.SIG_VOID_TO_OBJECT)
+ // @formatter:on
+ );
+
public enum NULLABLE {
TRUE
};
@@ -138,6 +147,12 @@
return;
}
+ if (NOTABLE_EXCEPTIONS.contains(new FQMethod(getClassName(), method.getName(), sig))) {
+ MethodInfo methodInfo = Statistics.getStatistics().getMethodStatistics(getClassName(), method.getName(), method.getSignature());
+ methodInfo.setCanReturnNull(false);
+ return;
+ }
+
if (methodHasNullableAnnotation(method)) {
if (isCollecting()) {
MethodInfo methodInfo = Statistics.getStatistics().getMethodStatistics(getClassName(), method.getName(), method.getSignature());
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FunctionalInterfaceIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FunctionalInterfaceIssues.java 2018-05-12 02:22:28 UTC (rev 1836)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FunctionalInterfaceIssues.java 2018-05-20 21:58:38 UTC (rev 1837)
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -43,6 +44,7 @@
import com.mebigfatguy.fbcontrib.utils.FQMethod;
import com.mebigfatguy.fbcontrib.utils.OpcodeUtils;
import com.mebigfatguy.fbcontrib.utils.QMethod;
+import com.mebigfatguy.fbcontrib.utils.SignatureUtils;
import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException;
import com.mebigfatguy.fbcontrib.utils.ToString;
import com.mebigfatguy.fbcontrib.utils.Values;
@@ -140,10 +142,14 @@
if ((m.getAccessFlags() & ACC_SYNTHETIC) != 0) {
List<FIInfo> fiis = functionalInterfaceInfo.get(m.getName());
if (fiis != null) {
- try {
- anonState = AnonState.SEEN_NOTHING;
- super.visitCode(obj);
- } catch (StopOpcodeParsingException e) {
+ if (SignatureUtils.getNumParameters(m.getSignature()) != 1) {
+ functionalInterfaceInfo.remove(m.getName());
+ } else {
+ try {
+ anonState = AnonState.SEEN_NOTHING;
+ super.visitCode(obj);
+ } catch (StopOpcodeParsingException e) {
+ }
}
}
}
@@ -183,6 +189,20 @@
throw new StopOpcodeParsingException();
}
} else if ((seen == ARETURN) && (getPC() == 1)) {
+ List<FIInfo> infos = functionalInterfaceInfo.get(getMethod().getName());
+ if (infos != null) {
+ Iterator<FIInfo> it = infos.iterator();
+ while (it.hasNext()) {
+ FIInfo info = it.next();
+ if (info.wasPrecededByExplicitStackOp()) {
+ it.remove();
+ }
+ }
+ if (infos.isEmpty()) {
+ functionalInterfaceInfo.remove(getMethod().getName());
+ }
+ }
+
anonymousBugType.put(getMethod().getName(), BugType.FII_USE_FUNCTION_IDENTITY);
throw new StopOpcodeParsingException();
} else {
@@ -195,6 +215,13 @@
if (!OpcodeUtils.isReturn(seen)) {
functionalInterfaceInfo.remove(getMethod().getName());
}
+
+ if (stack.getStackDepth() > 0) {
+ OpcodeStack.Item itm = stack.getStackItem(0);
+ if (!itm.getSignature().equals(SignatureUtils.getReturnSignature(getMethod().getSignature()))) {
+ functionalInterfaceInfo.remove(getMethod().getName());
+ }
+ }
anonymousBugType.put(getMethod().getName(), BugType.FII_USE_METHOD_REFERENCE);
throw new StopOpcodeParsingException();
@@ -217,7 +244,9 @@
functionalInterfaceInfo.put(anonName, fiis);
}
- FIInfo fii = new FIInfo(getMethod(), SourceLineAnnotation.fromVisitedInstruction(this));
+ int lastOp = getPrevOpcode(1);
+ FIInfo fii = new FIInfo(getMethod(), SourceLineAnnotation.fromVisitedInstruction(this),
+ OpcodeUtils.isALoad(lastOp) || (lastOp == GETFIELD) || (lastOp == GETSTATIC));
fiis.add(fii);
}
break;
@@ -377,10 +406,12 @@
static class FIInfo {
private Method method;
private SourceLineAnnotation srcLine;
+ private boolean precededByExplicitStackOp;
- public FIInfo(Method method, SourceLineAnnotation srcLine) {
+ public FIInfo(Method method, SourceLineAnnotation srcLine, boolean precededByExplicitStackOp) {
this.method = method;
this.srcLine = srcLine;
+ this.precededByExplicitStackOp = precededByExplicitStackOp;
}
public Method getMethod() {
@@ -391,6 +422,10 @@
return srcLine;
}
+ public boolean wasPrecededByExplicitStackOp() {
+ return precededByExplicitStackOp;
+ }
+
@Override
public String toString() {
return ToString.build(this);
Modified: trunk/fb-contrib/src/samples/java/ex/AI_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/AI_Sample.java 2018-05-12 02:22:28 UTC (rev 1836)
+++ trunk/fb-contrib/src/samples/java/ex/AI_Sample.java 2018-05-20 21:58:38 UTC (rev 1837)
@@ -61,6 +61,10 @@
});
}
+ public AI_Sample fpNotableExceptions284() throws Exception {
+ return AI_Sample.class.newInstance();
+ }
+
interface Stringer {
String get();
}
Modified: trunk/fb-contrib/src/samples/java/ex/FII_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/FII_Sample.java 2018-05-12 02:22:28 UTC (rev 1836)
+++ trunk/fb-contrib/src/samples/java/ex/FII_Sample.java 2018-05-20 21:58:38 UTC (rev 1837)
@@ -1,10 +1,15 @@
package ex;
+import java.math.BigDecimal;
import java.util.EnumSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.function.Function;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
public class FII_Sample {
@@ -57,6 +62,29 @@
return baubles.stream().filter(b -> b.getName().equals(name)).collect(Collectors.toSet()).size();
}
+ public void fpUnrelatedLambdaValue282(Map<String, Bauble> map, BaubleFactory factory) {
+ map.computeIfAbsent("pixie dust", _unused -> factory.getBauble());
+ }
+
+ public BigDecimal fpCastEliminatesMethodReference282(List<Bauble> baubles) {
+ return baubles.stream().filter(b -> b.getName().equals("special")).map(b -> (BigDecimal) b.getCost()).findFirst().get();
+ }
+
+ public static <T> Stream<T> fpIiteratorToFiniteStream283(Iterator<T> iterator, boolean parallel) {
+ Iterable<T> iterable = () -> iterator;
+ return StreamSupport.stream(iterable.spliterator(), parallel);
+ }
+
+ public void fpUseIdentity283() {
+ put(m -> {
+ m.putAll(m);
+ return m;
+ });
+ }
+
+ public void put(Function<Map<String, Object>, Map<String, Object>> updateFunction) {
+ }
+
public static class Bauble {
public String getName() {
@@ -66,8 +94,25 @@
public boolean isFree() {
return true;
}
+
+ public Number getCost() {
+ return 0.0;
+ }
}
+ public static class SpecialBauble extends Bauble {
+ @Override
+ public BigDecimal getCost() {
+ return new BigDecimal("0.0");
+ }
+ }
+
+ public static class BaubleFactory {
+ public Bauble getBauble() {
+ return new Bauble();
+ }
+ }
+
public enum GiantSpeak {
FEE, FI, FO, FUM, BLUB;
Modified: trunk/fb-contrib/yank.xls
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2018-06-01 00:35:53
|
Revision: 1839
http://sourceforge.net/p/fb-contrib/code/1839
Author: dbrosius
Date: 2018-06-01 00:34:34 +0000 (Fri, 01 Jun 2018)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FunctionalInterfaceIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/utils/SignatureBuilder.java
trunk/fb-contrib/src/samples/java/ex/ACEM_Sample.java
trunk/fb-contrib/src/samples/java/ex/AI_Sample.java
trunk/fb-contrib/src/samples/java/ex/LEST_Sample.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/.classpath 2018-06-01 00:34:34 UTC (rev 1839)
@@ -25,7 +25,7 @@
</classpathentry>
<classpathentry kind="lib" path="lib/threetenbp-1.3.2.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.10.jar"/>
- <classpathentry kind="lib" path="lib/commons-collections-3.2.2.jar"/>
+ <classpathentry kind="lib" path="lib/commons-collections-3.2.2.jar" sourcepath="/home/dave/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.4.jar"/>
<classpathentry kind="lib" path="lib/findbugs-ant-3.0.0.jar"/>
<classpathentry kind="lib" path="lib/guava-19.0.jar" sourcepath="lib/sources/guava-19.0-sources.jar"/>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/build.xml 2018-06-01 00:34:34 UTC (rev 1839)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.4.1" />
+ <property name="fb-contrib.version" value="7.4.2" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -51,7 +51,7 @@
<target name="yank" xmlns:yank="antlib:com.mebigfatguy.yank" unless="no.yank">
<mkdir dir="${lib.dir}" />
- <yank:yank yankFile="${basedir}/yank.xls" destination="${lib.dir}" proxyServer="${proxy.server}" source="true" separateClassifierTypes="true" checkSHADigests="true">
+ <yank:yank yankFile="${basedir}/yank.csv" destination="${lib.dir}" proxyServer="${proxy.server}" source="true" separateClassifierTypes="true" checkSHADigests="true">
<server url="http://repo1.maven.org/maven2" />
<generateVersions propertyFileName="${basedir}/version.properties" />
</yank:yank>
@@ -126,8 +126,10 @@
<pathelement location="${lib.dir}/javax.servlet-api-${javax.servlet-api.version}.jar" />
<pathelement location="${lib.dir}/log4j-${log4j.version}.jar" />
<pathelement location="${lib.dir}/log4j-api-${log4j-api.version}.jar" />
- <pathelement location="${lib.dir}/commons-lang3-${commons-lang3.version}.jar" />
- <pathelement location="${lib.dir}/commons-io-${commons-io.version}.jar" />
+ <pathelement location="${lib.dir}/commons-collections-${commons-collections.version}.jar" />
+ <pathelement location="${lib.dir}/commons-lang3-${commons-lang3.version}.jar" />
+ <pathelement location="${lib.dir}/commons-io-${commons-io.version}.jar" />
+ <pathelement location="${lib.dir}/dom4j-${dom4j.version}.jar" />
<pathelement location="${lib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
<pathelement location="${lib.dir}/threetenbp-${threetenbp.version}.jar" />
<pathelement location="${lib.dir}/slf4j-api-${slf4j-api.version}.jar" />
@@ -139,7 +141,8 @@
<pathelement location="${lib.dir}/spring-beans-${spring-beans.version}.jar" />
<pathelement location="${lib.dir}/spring-context-${spring-context.version}.jar" />
<pathelement location="${lib.dir}/spring-tx-${spring-tx.version}.jar" />
- <pathelement location="${lib.dir}/javax.persistence-${javax.persistence.version}.jar" />
+ <pathelement location="${lib.dir}/javax.persistence-${javax.persistence.version}.jar" />
+ <pathelement location="${lib.dir}/jaxen-${jaxen.version}.jar" />
<pathelement location="${lib.dir}/mockito-core-${mockito-core.version}.jar" />
<pathelement location="${lib.dir}/hamcrest-core-${hamcrest-core.version}.jar" />
<pathelement location="${lib.dir}/jena-shaded-guava-${jena-shaded-guava.version}.jar" />
@@ -248,7 +251,7 @@
<include name="**/*.license" />
<include name="**/*.txt" />
<include name="**/*.md" />
- <include name="**/*.xls" />
+ <include name="**/*.csv" />
<include name="**/*.example" />
<include name="**/*.fbp" />
</fileset>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/htdocs/index.shtml 2018-06-01 00:34:34 UTC (rev 1839)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.4.1 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.4.2 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/htdocs/repository.html 2018-06-01 00:34:34 UTC (rev 1839)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.4.1 or 7.4.1.sb</td></tr>
+ <tr><td><b>Version:</b></td><td>7.4.2 or 7.4.2.sb</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/pom.xml 2018-06-01 00:34:34 UTC (rev 1839)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.4.1</version>
+ <version>7.4.2</version>
<!-- TODO: Delete this and replace with enforcer plugin. This is for maven plugins only! Latest maven will through warnings. -->
<prerequisites>
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -112,7 +112,12 @@
return;
}
- if (!interfaceMethods.contains(new QMethod(methodName, getMethod().getSignature()))) {
+ Method m = getMethod();
+ if (m.isSynthetic()) {
+ return;
+ }
+
+ if (!interfaceMethods.contains(new QMethod(methodName, m.getSignature()))) {
super.visitCode(obj);
}
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -18,9 +18,13 @@
*/
package com.mebigfatguy.fbcontrib.detect;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -33,9 +37,12 @@
import com.mebigfatguy.fbcontrib.collect.MethodInfo;
import com.mebigfatguy.fbcontrib.collect.Statistics;
import com.mebigfatguy.fbcontrib.utils.BugType;
+import com.mebigfatguy.fbcontrib.utils.CodeByteUtils;
import com.mebigfatguy.fbcontrib.utils.FQMethod;
+import com.mebigfatguy.fbcontrib.utils.OpcodeUtils;
import com.mebigfatguy.fbcontrib.utils.SignatureBuilder;
import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException;
+import com.mebigfatguy.fbcontrib.utils.ToString;
import com.mebigfatguy.fbcontrib.utils.UnmodifiableSet;
import com.mebigfatguy.fbcontrib.utils.Values;
@@ -56,6 +63,13 @@
private static final String USER_NULLABLE_ANNOTATIONS = "fb-contrib.ai.annotations";
+ private static final Set<String> IS_EMPTY_SIGNATURES = UnmodifiableSet.create(
+ // @formatter:off
+ new SignatureBuilder().withParamTypes(Collection.class).withReturnType(boolean.class).build(),
+ new SignatureBuilder().withParamTypes(Map.class).withReturnType(boolean.class).build()
+ // @formatter:on
+ );
+
private static final Set<String> NULLABLE_ANNOTATIONS = new HashSet<>();
static {
@@ -82,8 +96,18 @@
// @formatter:on
);
- public enum NULLABLE {
- TRUE
+ public static class AIUserValue {
+
+ int reg;
+
+ public AIUserValue(int reg) {
+ this.reg = reg;
+ }
+
+ @Override
+ public String toString() {
+ return ToString.build(this);
+ }
};
private BugReporter bugReporter;
@@ -90,6 +114,7 @@
private Map<Integer, Integer> assumedNullTill;
private Map<Integer, Integer> assumedNonNullTill;
private Set<Integer> noAssumptionsPossible;
+ private List<Integer> branchTargets;
private OpcodeStack stack;
private boolean methodIsNullable;
@@ -117,6 +142,7 @@
assumedNullTill = new HashMap<>();
assumedNonNullTill = new HashMap<>();
noAssumptionsPossible = new HashSet<>();
+ branchTargets = new ArrayList<>();
super.visitClassContext(classContext);
}
}
@@ -125,6 +151,7 @@
assumedNullTill = null;
assumedNonNullTill = null;
noAssumptionsPossible = null;
+ branchTargets = null;
}
}
@@ -171,6 +198,7 @@
assumedNullTill.clear();
assumedNonNullTill.clear();
noAssumptionsPossible.clear();
+ branchTargets.clear();
try {
super.visitCode(obj);
@@ -190,11 +218,23 @@
@Override
public void sawOpcode(int seen) {
- boolean resultIsNullable = false;
+ AIUserValue userValue = null;
+ if (OpcodeUtils.isBranch(seen) && (getBranchOffset() > 0)) {
+ branchTargets.add(getBranchTarget());
+ Collections.sort(branchTargets);
+ }
+
+ clearBranchTargets(getPC());
+ convertNullToNonNull(getPC());
clearAssumptions(assumedNullTill, getPC());
clearAssumptions(assumedNonNullTill, getPC());
+ if (OpcodeUtils.isBranch(seen) && (getBranchOffset() > 0)) {
+ branchTargets.add(getBranchTarget());
+ Collections.sort(branchTargets);
+ }
+
try {
switch (seen) {
case ARETURN: {
@@ -201,8 +241,8 @@
if (!methodIsNullable && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
Integer reg = Integer.valueOf(itm.getRegisterNumber());
- methodIsNullable = !noAssumptionsPossible.contains(reg) && ((assumedNullTill.containsKey(reg) && !assumedNonNullTill.containsKey(reg))
- || isStackElementNullable(getClassName(), getMethod(), itm));
+ methodIsNullable = !assumedNonNullTill.containsKey(reg) && (!noAssumptionsPossible.contains(reg)
+ && ((assumedNullTill.containsKey(reg)) || isStackElementNullable(getClassName(), getMethod(), itm)));
if (methodIsNullable) {
throw new StopOpcodeParsingException();
}
@@ -234,10 +274,39 @@
}
break;
+ case IFEQ:
+ if ((getBranchOffset() > 0) && (stack.getStackDepth() > 0)) {
+ OpcodeStack.Item itm = stack.getStackItem(0);
+ AIUserValue uv = (AIUserValue) itm.getUserValue();
+ if ((uv != null) && (uv.reg >= 0)) {
+ assumedNullTill.put(uv.reg, getBranchTarget());
+ }
+ }
+ break;
+
case INVOKESTATIC:
+ if (stack.getStackDepth() > 0) {
+ String signature = getSigConstantOperand();
+ if (IS_EMPTY_SIGNATURES.contains(signature)) {
+ String methodName = getNameConstantOperand();
+ if (methodName.equals("isEmpty")) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ int reg = item.getRegisterNumber();
+ if (reg >= 0) {
+ userValue = new AIUserValue(reg);
+ break;
+ }
+ }
+ }
+ }
+
+ // $FALL-THROUGH$
case INVOKEINTERFACE:
case INVOKEVIRTUAL: {
- resultIsNullable = (isMethodNullable(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand()));
+ boolean resultIsNullable = (isMethodNullable(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand()));
+ if (resultIsNullable) {
+ userValue = new AIUserValue(-1);
+ }
break;
}
@@ -250,9 +319,9 @@
}
} finally {
stack.sawOpcode(this, seen);
- if ((resultIsNullable) && (stack.getStackDepth() > 0)) {
+ if ((userValue != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
- itm.setUserValue(NULLABLE.TRUE);
+ itm.setUserValue(userValue);
}
}
}
@@ -269,7 +338,7 @@
}
public static boolean isStackElementNullable(String className, Method method, OpcodeStack.Item itm) {
- if (itm.isNull() || (itm.getUserValue() instanceof NULLABLE)) {
+ if (itm.isNull() || (itm.getUserValue() != null)) {
MethodInfo mi = Statistics.getStatistics().getMethodStatistics(className, method.getName(), method.getSignature());
if (mi != null) {
mi.setCanReturnNull(true);
@@ -321,6 +390,47 @@
}
}
+ public void convertNullToNonNull(int pc) {
+ for (Map.Entry<Integer, Integer> entry : assumedNullTill.entrySet()) {
+ if (entry.getValue().intValue() == pc) {
+ int lastOp = getPrevOpcode(1);
+ if ((lastOp == ARETURN) || (lastOp == ATHROW)) {
+ int nonNullTill = getNextBranchTarget();
+ assumedNonNullTill.put(entry.getKey(), nonNullTill);
+ } else if (OpcodeUtils.isBranch(lastOp)) {
+ int branchOffset = CodeByteUtils.getshort(getCode().getCode(), getPC() - 2);
+ if (branchOffset > 0) {
+ assumedNonNullTill.put(entry.getKey(), getPC() + branchOffset);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * remove branch targets that have been passed
+ *
+ * @param pc
+ * the current pc
+ */
+ public void clearBranchTargets(int pc) {
+ Iterator<Integer> it = branchTargets.iterator();
+ while (it.hasNext()) {
+ int target = it.next().intValue();
+ if (target <= pc) {
+ it.remove();
+ }
+ }
+ }
+
+ public int getNextBranchTarget() {
+ if (branchTargets.isEmpty()) {
+ return Integer.MAX_VALUE;
+ }
+
+ return branchTargets.get(0);
+ }
+
public void removeAssumptions(Map<Integer, Integer> assumptionsTill) {
noAssumptionsPossible.addAll(assumptionsTill.keySet());
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -347,7 +347,7 @@
private void addLineNumber(BitSet lineNumbers) {
LineNumberTable lnt = getCode().getLineNumberTable();
if (lnt == null) {
- lineNumbers.set(-lineNumbers.size());
+ lineNumbers.set(0);
} else {
int line = lnt.getSourceLine(getPC());
if (line < 0) {
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FunctionalInterfaceIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FunctionalInterfaceIssues.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/FunctionalInterfaceIssues.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -44,6 +44,7 @@
import com.mebigfatguy.fbcontrib.utils.FQMethod;
import com.mebigfatguy.fbcontrib.utils.OpcodeUtils;
import com.mebigfatguy.fbcontrib.utils.QMethod;
+import com.mebigfatguy.fbcontrib.utils.SignatureBuilder;
import com.mebigfatguy.fbcontrib.utils.SignatureUtils;
import com.mebigfatguy.fbcontrib.utils.StopOpcodeParsingException;
import com.mebigfatguy.fbcontrib.utils.ToString;
@@ -65,14 +66,14 @@
private static final int REF_invokeStatic = 6;
- private static final QMethod CONTAINS = new QMethod("contains", "(Ljava/lang/Object;)Z");
- private static final QMethod SIZE = new QMethod("size", "()I");
+ private static final QMethod CONTAINS = new QMethod("contains", SignatureBuilder.SIG_OBJECT_TO_BOOLEAN);
+ private static final QMethod SIZE = new QMethod("size", SignatureBuilder.SIG_VOID_TO_INT);
private static final FQMethod COLLECT = new FQMethod("java/util/stream/Stream", "collect", "(Ljava/util/stream/Collector;)Ljava/lang/Object;");
private static final FQMethod FILTER = new FQMethod("java/util/stream/Stream", "filter", "(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;");
private static final FQMethod FINDFIRST = new FQMethod("java/util/stream/Stream", "findFirst", "()Ljava/util/Optional;");
- private static final FQMethod ISPRESENT = new FQMethod("java/util/Optional", "isPresent", "()Z");
- private static final FQMethod GET = new FQMethod("java/util/List", "get", "(I)Ljava/lang/Object;");
+ private static final FQMethod ISPRESENT = new FQMethod("java/util/Optional", "isPresent", SignatureBuilder.SIG_VOID_TO_BOOLEAN);
+ private static final FQMethod GET = new FQMethod("java/util/List", "get", SignatureBuilder.SIG_INT_TO_OBJECT);
enum ParseState {
NORMAL, LAMBDA;
@@ -367,7 +368,7 @@
@Nullable
private String getAnonymousName(ConstantMethodHandle cmh) {
- if (cmh.getReferenceKind() != REF_invokeStatic) {
+ if ((cmh == null) || (cmh.getReferenceKind() != REF_invokeStatic)) {
return null;
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -268,10 +268,10 @@
/**
* parses the current class for spring-tx and jpa annotations, as well as hashCode and equals methods.
*
- * @param cls
+ * @param clz
* the currently parsed class
*/
- private void catalogClass(JavaClass cls) {
+ private void catalogClass(JavaClass clz) {
transactionalMethods = new HashMap<>();
isEntity = false;
hasId = false;
@@ -279,7 +279,7 @@
hasEagerOneToMany = false;
hasHCEquals = false;
- for (AnnotationEntry entry : cls.getAnnotationEntries()) {
+ for (AnnotationEntry entry : clz.getAnnotationEntries()) {
if ("Ljavax/persistence/Entity;".equals(entry.getAnnotationType())) {
isEntity = true;
break;
@@ -286,7 +286,7 @@
}
}
- for (Method m : cls.getMethods()) {
+ for (Method m : clz.getMethods()) {
catalogFieldOrMethod(m);
if (("equals".equals(m.getName()) && SignatureBuilder.SIG_OBJECT_TO_BOOLEAN.equals(m.getSignature()))
@@ -295,7 +295,7 @@
}
}
- for (Field f : cls.getFields()) {
+ for (Field f : clz.getFields()) {
catalogFieldOrMethod(f);
}
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -241,8 +241,9 @@
markAsValid = true; // Fixes javac generated code
}
}
- } else if (("getTargetException".equals(methodName) || "getCause".equals(methodName))
- && "java/lang/reflect/InvocationTargetException".equals(getClassConstantOperand())) {
+ } else if ((("getTargetException".equals(methodName) || "getCause".equals(methodName))
+ && "java/lang/reflect/InvocationTargetException".equals(getClassConstantOperand()))
+ || "java/io/UncheckedIOException".equals(getClassConstantOperand())) {
markAsValid = true;
} else if (isPossibleExBuilder(catchInfo.getRegister())) {
markAsValid = true;
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/OptionalIssues.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -55,7 +55,7 @@
private static Set<String> BOXED_OPTIONAL_TYPES = UnmodifiableSet.create("Ljava/lang/Integer;", "Ljava/lang/Long;", "Ljava/lang/Double;");
- private static final FQMethod OPTIONAL_OR_ELSE_METHOD = new FQMethod("java/util/Optional", "orElse", "(Ljava/lang/Object;)Ljava/lang/Object;");
+ private static final FQMethod OPTIONAL_OR_ELSE_METHOD = new FQMethod("java/util/Optional", "orElse", SignatureBuilder.SIG_OBJECT_TO_OBJECT);
private static final FQMethod OPTIONAL_OR_ELSE_GET_METHOD = new FQMethod("java/util/Optional", "orElseGet",
"(Ljava/util/function/Supplier;)Ljava/lang/Object;");
private static final FQMethod OPTIONAL_GET_METHOD = new FQMethod("java/util/Optional", "get", SignatureBuilder.SIG_VOID_TO_OBJECT);
@@ -64,8 +64,8 @@
// @formatter:off
OPTIONAL_OR_ELSE_METHOD,
new FQMethod("java/util/OptionalDouble", "orElse", "(D)D"),
- new FQMethod("java/util/OptionalInt", "orElse", "(I)I"),
- new FQMethod("java/util/OptionalLong", "orElse", "(J)J")
+ new FQMethod("java/util/OptionalInt", "orElse", SignatureBuilder.SIG_INT_TO_INT),
+ new FQMethod("java/util/OptionalLong", "orElse", SignatureBuilder.SIG_LONG_TO_LONG)
// @formatter:on
);
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -460,7 +460,7 @@
return true;
}
- if ((seen != IFNE) || (stack.getStackDepth() == 0)) {
+ if (((seen != IFNE) && (seen != IFEQ)) || (stack.getStackDepth() == 0)) {
return false;
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -18,6 +18,8 @@
*/
package com.mebigfatguy.fbcontrib.detect;
+import java.lang.reflect.AccessibleObject;
+
import org.apache.bcel.Repository;
import org.apache.bcel.classfile.JavaClass;
@@ -24,6 +26,7 @@
import com.mebigfatguy.fbcontrib.utils.BugType;
import com.mebigfatguy.fbcontrib.utils.FQMethod;
import com.mebigfatguy.fbcontrib.utils.QMethod;
+import com.mebigfatguy.fbcontrib.utils.SignatureBuilder;
import edu.umd.cs.findbugs.BugInstance;
import edu.umd.cs.findbugs.BugReporter;
@@ -32,9 +35,9 @@
public class ReflectionIssues extends BytecodeScanningDetector {
- private static final QMethod SETACCESSIBLE = new QMethod("setAccessible", "(Z)V");
+ private static final QMethod SETACCESSIBLE = new QMethod("setAccessible", SignatureBuilder.SIG_BOOLEAN_TO_VOID);
private static final FQMethod SETACCESSIBLE_ARRAY = new FQMethod("java/lang/reflect/AccessibleObject", "setAccessible",
- "([Ljava/lang/reflect/AccessibleObject;Z)V");
+ new SignatureBuilder().withParamTypes(AccessibleObject.class).build());
private static final JavaClass ACCESSIBLE_OBJECT_CLASS;
static {
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2018-05-20 22:03:10 UTC (rev 1838)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2018-06-01 00:34:34 UTC (rev 1839)
@@ -28,6 +28,7 @@
import com.mebigfatguy.fbcontrib.utils.BugType;
import com.mebigfatguy.fbcontrib.utils.QMethod;
+import com.mebigfatguy.fbcontrib.utils.SignatureBuilder;
import com.mebigfatguy.fbcontrib.utils.ToString;
import com.mebigfatguy.fbcontrib.utils.UnmodifiableSet;
import com.mebigfatguy.fbcontrib.utils.Values;
@@ -46,15 +47,15 @@
private static final Set<QMethod> OBJECT_METHODS = UnmodifiableSet.create(
// @formatter:off
- new QMethod("equals", "(Ljava/lang/Object;)Z"),
- new QMethod(Values.HASHCODE, "()I"),
- new QMethod(Values.TOSTRING, "()Ljava/lang/String;"),
- new QMethod("clone", "()Ljava/lang/Object;"),
- new QMethod("notify", "()V"),
- new QMethod("notifyAll", "()V"),
- new QMethod("wait", "(J)V"),
+ new QMethod("equals", SignatureBuilder.SIG_OBJECT_TO_BOOLEAN),
+ new QMethod(Values.HASHCODE, SignatureBuilder.SIG_VOID_TO_INT),
+ new QMethod(Values.TOSTRING, SignatureBuilder.SIG_VOID_TO_STRING),
+ new QMethod("clone", SignatureBuilder.SIG_VOID_TO_OBJECT),
+ new QMethod("notify", SignatureBuilder.SIG_VOID_TO_VOID),
+ ...
[truncated message content] |
|
From: <dbr...@us...> - 2018-07-21 17:43:54
|
Revision: 1841
http://sourceforge.net/p/fb-contrib/code/1841
Author: dbrosius
Date: 2018-07-21 17:43:49 +0000 (Sat, 21 Jul 2018)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/Statistics.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java
trunk/fb-contrib/src/samples/java/ex/AI_Sample.java
trunk/fb-contrib/src/samples/java/ex/PRMC_Sample.java
Added Paths:
-----------
trunk/fb-contrib/yank.csv
Removed Paths:
-------------
trunk/fb-contrib/yank.xls
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/build.xml 2018-07-21 17:43:49 UTC (rev 1841)
@@ -31,7 +31,7 @@
<property name="javac.debug" value="on" />
<property name="test_reports.dir" value="${target.dir}/reports/test"/>
- <property name="fb-contrib.version" value="7.4.2" />
+ <property name="fb-contrib.version" value="7.4.3" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -42,7 +42,7 @@
<target name="infra_jars" description="pull jars needed to build fb-contrib to ${user.dir}/.ant/lib">
<mkdir dir="${user.home}/.ant/lib" />
- <get src="http://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/2.0.0/yank-2.0.0.jar" dest="${user.home}/.ant/lib"/>
+ <get src="http://repo1.maven.org/maven2/com/mebigfatguy/yank/yank/2.0.1/yank-2.0.1.jar" dest="${user.home}/.ant/lib"/>
<get src="https://bitbucket.org/kjlubick/bugrankcheckstyle/downloads/bug-rank-check-style-1.0.0.jar" dest="${user.home}/.ant/lib"/>
<get src="http://repo1.maven.org/maven2/com/mebigfatguy/vcsversion/vcsversion/0.4.0/vcsversion-0.4.0.jar" dest="${user.home}/.ant/lib"/>
<get src="http://repo1.maven.org/maven2/com/mebigfatguy/fb-delta/fb-delta/0.6.0/fb-delta-0.6.0.jar" dest="${user.home}/.ant/lib" ignoreerrors="true"/>
@@ -151,7 +151,7 @@
</path>
</target>
- <target name="validate_xml" depends="-init" description="validates the xml files">
+ <target name="validate_xml" depends="-init" unless="skip-validate" description="validates the xml files">
<taskdef name="bug-rank-check-style" classname="text.style.check.BugRankCheckStyleTask"/>
<xmlvalidate lenient="false" failonerror="yes">
<attribute name="http://apache.org/xml/features/validation/schema" value="true" />
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/etc/messages.xml 2018-07-21 17:43:49 UTC (rev 1841)
@@ -6190,6 +6190,9 @@
produces a far simpler instance of List. Since both of these arrays are immutable (from the List's point of view) they are equivalent from a usage
standpoint.
</p>
+ <p>There is one difference between Array.asList and Collections.singletonList that you should be mindful of. The rarely used set(index, value) method is
+ allowed to be used with a List created by Array.asList, but not with Collections.singletonList. So if you do use the set(index, value) method
+ continue using Arrays.asList.
]]>
</Details>
</BugPattern>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/htdocs/index.shtml 2018-07-21 17:43:49 UTC (rev 1841)
@@ -68,7 +68,7 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 7.4.2 available for download
+ <p style="font-weight: bold;">The latest version of fb-contrib is 7.4.3 available for download
<a href="http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22fb-contrib%22">here</a>.</p>
<p style="font-weight: bold;">This version requires FindBugs 3.0.1 or better</p>
<p style="font-weight: bold;">Please note that active development for this project is now done on
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/htdocs/repository.html 2018-07-21 17:43:49 UTC (rev 1841)
@@ -22,7 +22,7 @@
<table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;">
<tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>7.4.2 or 7.4.2.sb</td></tr>
+ <tr><td><b>Version:</b></td><td>7.4.3 or 7.4.3.sb</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/pom.xml 2018-07-21 17:43:49 UTC (rev 1841)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>7.4.2</version>
+ <version>7.4.3</version>
<!-- TODO: Delete this and replace with enforcer plugin. This is for maven plugins only! Latest maven will through warnings. -->
<prerequisites>
@@ -90,6 +90,9 @@
<contributor>
<name>David Burström</name>
</contributor>
+ <contributor>
+ <name>Venkata Gajavalli</name>
+ </contributor>
</contributors>
<licenses>
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2018-07-21 17:43:49 UTC (rev 1841)
@@ -138,7 +138,8 @@
String clsName = getClassName();
Method method = getMethod();
int accessFlags = method.getAccessFlags();
- MethodInfo mi = Statistics.getStatistics().addMethodStatistics(clsName, getMethodName(), getMethodSig(), accessFlags, obj.getLength(), numMethodCalls);
+ MethodInfo mi = Statistics.getStatistics().addMethodStatistics(clsName, getMethodName(), getMethodSig(), accessFlags, code.length,
+ numMethodCalls);
if ((clsName.indexOf(Values.INNER_CLASS_SEPARATOR) >= 0) || ((accessFlags & (ACC_ABSTRACT | ACC_INTERFACE | ACC_ANNOTATION)) != 0)) {
mi.addCallingAccess(Constants.ACC_PUBLIC);
} else if ((accessFlags & Constants.ACC_PRIVATE) == 0) {
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/Statistics.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/Statistics.java 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/collect/Statistics.java 2018-07-21 17:43:49 UTC (rev 1841)
@@ -18,11 +18,11 @@
*/
package com.mebigfatguy.fbcontrib.collect;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import com.mebigfatguy.fbcontrib.utils.FQMethod;
import com.mebigfatguy.fbcontrib.utils.ToString;
@@ -38,7 +38,7 @@
private static Statistics statistics = new Statistics();
private static final MethodInfo NOT_FOUND_METHOD_INFO = new MethodInfo();
- private final Map<FQMethod, MethodInfo> methodStatistics = new HashMap<>();
+ private final Map<FQMethod, MethodInfo> methodStatistics = new ConcurrentHashMap<>();
private final Set<String> autowiredBeans = new HashSet<>();
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/AnnotationIssues.java 2018-07-21 17:43:49 UTC (rev 1841)
@@ -79,7 +79,7 @@
NULLABLE_ANNOTATIONS.add("Lcom/sun/istack/Nullable;");
NULLABLE_ANNOTATIONS.add("Ledu/umd/cs/findbugs/annotations/Nullable;");
NULLABLE_ANNOTATIONS.add("Lorg/springframework/lang/Nullable;");
- NULLABLE_ANNOTATIONS.add("Landroid/support/annotations/Nullable");
+ NULLABLE_ANNOTATIONS.add("Landroid/support/annotation/Nullable");
String userAnnotations = System.getProperty(USER_NULLABLE_ANNOTATIONS);
if ((userAnnotations != null) && !userAnnotations.isEmpty()) {
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2018-07-21 17:43:49 UTC (rev 1841)
@@ -64,6 +64,8 @@
public static final String PRMC_HIGH_METHODCALLS = "fbcontrib.PRMC.highmethodcalls";
public static final String PRMC_NORMAL_BYTECOUNT = "fbcontrib.PRMC.normalbytecount";
public static final String PRMC_NORMAL_METHODCALLS = "fbcontrib.PRMC.normalmethodcalls";
+ public static final String PRMC_LOW_BYTECOUNT = "fbcontrib.PRMC.lowbytecount";
+ public static final String PRMC_LOW_METHODCALLS = "fbcontrib.PRMC.lowmethodcalls";
/**
* a collection of names that are to be checked against a currently parsed method, to see if that method is risky to be called redundant. The contents are
@@ -76,8 +78,10 @@
private static Set<String> riskyMethodNameContents = new HashSet<>();
private static int highByteCountLimit = 200;
private static int highMethodCallLimit = 10;
- private static int normalByteCountLimit = 50;
+ private static int normalByteCountLimit = 75;
private static int normalMethodCallLimit = 4;
+ private static int lowByteCountLimit = 10;
+ private static int lowMethodCallLimit = 1;
static {
riskyMethodNameContents.add("next");
@@ -130,6 +134,14 @@
if (prop != null) {
normalMethodCallLimit = prop.intValue();
}
+ prop = Integer.getInteger(PRMC_LOW_BYTECOUNT);
+ if (prop != null) {
+ lowByteCountLimit = prop.intValue();
+ }
+ prop = Integer.getInteger(PRMC_LOW_METHODCALLS);
+ if (prop != null) {
+ lowMethodCallLimit = prop.intValue();
+ }
}
private static Set<String> riskyClassNames = new HashSet<>();
@@ -372,8 +384,7 @@
if (mc != null) {
if (!signature.endsWith(Values.SIG_VOID) && methodName.equals(mc.getName()) && signature.equals(mc.getSignature())
- && !isRiskyName(className, methodName)
- && !commonMethods.contains(new FQMethod(getClassConstantOperand(), methodName, signature))) {
+ && !isRiskyName(className, methodName) && !commonMethods.contains(new FQMethod(className, methodName, signature))) {
Object[] parms = mc.getParms();
if (Arrays.equals(parms, parmConstants)) {
int ln = getLineNumber(pc);
@@ -380,7 +391,7 @@
if ((ln != mc.getLineNumber()) || (Math.abs(pc - mc.getPC()) < 10)) {
Statistics statistics = Statistics.getStatistics();
- MethodInfo mi = statistics.getMethodStatistics(getClassConstantOperand(), methodName, signature);
+ MethodInfo mi = statistics.getMethodStatistics(className, methodName, signature);
bugReporter.reportBug(
new BugInstance(this, BugType.PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS.name(), getBugPriority(methodName, mi))
@@ -461,7 +472,7 @@
return NORMAL_PRIORITY;
}
- if ((mi.getNumBytes() == 0) || (mi.getNumMethodCalls() == 0)) {
+ if ((mi.getNumBytes() >= lowByteCountLimit) || (mi.getNumMethodCalls() >= lowMethodCallLimit)) {
return LOW_PRIORITY;
}
Modified: trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java
===================================================================
--- trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/src/main/java/com/mebigfatguy/fbcontrib/detect/ReflectionIssues.java 2018-07-21 17:43:49 UTC (rev 1841)
@@ -37,7 +37,7 @@
private static final QMethod SETACCESSIBLE = new QMethod("setAccessible", SignatureBuilder.SIG_BOOLEAN_TO_VOID);
private static final FQMethod SETACCESSIBLE_ARRAY = new FQMethod("java/lang/reflect/AccessibleObject", "setAccessible",
- new SignatureBuilder().withParamTypes(AccessibleObject.class).build());
+ new SignatureBuilder().withParamTypes(AccessibleObject[].class, boolean.class).build());
private static final JavaClass ACCESSIBLE_OBJECT_CLASS;
static {
Modified: trunk/fb-contrib/src/samples/java/ex/AI_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/AI_Sample.java 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/src/samples/java/ex/AI_Sample.java 2018-07-21 17:43:49 UTC (rev 1841)
@@ -97,6 +97,23 @@
return ss;
}
+ public String fpGetProperty296(final String key, final String defaultValue) {
+ String strResult = getProperty(key);
+ if (strResult != null) {
+ return strResult;
+ } else {
+ putDefault(key, defaultValue);
+ return defaultValue;
+ }
+ }
+
+ public String getProperty(final String key) {
+ return Math.random() > 0.5 ? null : "";
+ }
+
+ private void putDefault(String key, String value) {
+ }
+
interface Stringer {
String get();
}
Modified: trunk/fb-contrib/src/samples/java/ex/PRMC_Sample.java
===================================================================
--- trunk/fb-contrib/src/samples/java/ex/PRMC_Sample.java 2018-06-01 00:39:50 UTC (rev 1840)
+++ trunk/fb-contrib/src/samples/java/ex/PRMC_Sample.java 2018-07-21 17:43:49 UTC (rev 1841)
@@ -106,6 +106,15 @@
List p = Collections.emptyList();
}
+ public void fpSimpleGetter() {
+ getData();
+ getData();
+ }
+
+ public String getData() {
+ return data;
+ }
+
enum FPEnum {
fee, fi, fo, fum
};
Added: trunk/fb-contrib/yank.csv
===================================================================
--- trunk/fb-contrib/yank.csv (rev 0)
+++ trunk/fb-contrib/yank.csv 2018-07-21 17:43:49 UTC (rev 1841)
@@ -0,0 +1,73 @@
+"GroupId","ArtifactId","Version","Digest"
+,,,
+"com.google.code.findbugs","findbugs","3.0.1","7ae69957c437fd71628d3904572170cf80c01551"
+,"bcel-findbugs","6.0","7a7563ba41dceff3da4af4927b7c09908bd5132c"
+,"findbugs-annotations","3.0.1","0bf2342edabc0fc37fc0b1de0b03f071bef935c3"
+,"findbugs-ant","3.0.0","56f704b2769296de1b86102caefb6e8bd8b979af"
+,"jsr305","3.0.2","25ea2e8b0c338a877313bd4672d3fe056ea78f0d"
+,,,
+"jaxen","jaxen","1.1.6","3f8c36d9a0578e8e98f030c662b69888b1430ac0"
+,,,
+"dom4j","dom4j","1.6.1","5d3ccc056b6f056dbf0dddfdf43894b9065a8f94"
+,,,
+"org.ow2.asm","asm-debug-all","5.0.2","5742eaa4eb2f0583b642eb2a2a7597c996139103"
+,,,
+"org.testng","testng","6.9.10","6feb3e964aeb7097aff30c372aac3ec0f8d87ede"
+,,,
+"com.beust","jcommander","1.48","bfcb96281ea3b59d626704f74bc6d625ff51cbce"
+,,,
+"org.beanshell","bsh","2.0b4","a05f0a0feefa8d8467ac80e16e7de071489f0d9c"
+,,,
+"com.google.inject","guice","4.1.0","eeb69005da379a10071aa4948c48d89250febb07"
+,,,
+"----- Jars for Samples ----",,,
+,,,
+"org.apache.commons","commons-lang3","3.4","5fe28b9518e58819180a43a850fbc0dd24b7c050"
+,,,
+"javax.servlet.jsp","javax.servlet.jsp-api","2.3.1","95c630902565feda8155eb32d46064ef348435fc"
+,,,
+"junit","junit","4.12","2973d150c0dc1fefe998f834810d68f278ea58ec"
+,,,
+"log4j","log4j","1.2.17","5af35056b4d257e4b64b9e8069c0746e8b08629f"
+,,,
+"org.apache.logging.log4j","log4j-api","2.9.1","7a2999229464e7a324aa503c0a52ec0f05efe7bd"
+,,,
+"javax.servlet","javax.servlet-api","3.1.0","3cd63d075497751784b2fa84be59432f4905bf7c"
+,,,
+"backport-util-concurrent","backport-util-concurrent","3.1","682f7ac17fed79e92f8e87d8455192b63376347b"
+,,,
+"org.threeten","threetenbp","1.3.2","6ef0f1feae9c5b5cce4b3478e8f1541d1c86ec2a"
+,,,
+"commons-collections","commons-collections","3.2.2","8ad72fe39fa8c91eaaf12aadb21e0c3661fe26d5"
+,,,
+"org.slf4j","slf4j-api","1.7.21","139535a69a4239db087de9bab0bee568bf8e0b70"
+,,,
+"com.google.guava","guava","19.0","6ce200f6b23222af3d8abb6b6459e6c44f4bb0e9"
+,,,
+"org.apache.httpcomponents","httpclient","4.5.2","733db77aa8d9b2d68015189df76ab06304406e50"
+,"httpcore","4.4.5","e7501a1b34325abb00d17dde96150604a0658b54"
+,"httpclient-cache","4.5.2","bd50ea83908dbf2f387a333216e66d2f0c5079bd"
+,,,
+"commons-codec","commons-codec","1.10","4b95f4897fa13f2cd904aee711aeafc0c5295cd8"
+,,,
+"javax.ws.rs","javax.ws.rs-api","2.0.1","104e9c2b5583cfcfeac0402316221648d6d8ea6b"
+,,,
+"org.glassfish.jersey.media","jersey-media-multipart","2.25.1","1d2db0078ee1b740c4e7ec7413d328a8a7e1c480"
+,,,
+"org.springframework","spring-tx","4.3.3.RELEASE","15fe147d2725b9b85bfe79817dc10b4246d0364d"
+,"spring-beans",,"8e446175b4c8f9bf42abfa11e8194cb729171675"
+,"spring-context",,"cfcd94c9b28d71e81bdfc058fd386c1aa4a61aea"
+,,,
+"org.eclipse.persistence","javax.persistence","2.1.1","4954fdf995d5083a1bdbf171ea3b240b88c85bac"
+,,,
+"commons-io","commons-io","2.4","b1b6ea3b7e4aa4f492509a4952029cd8e48019ad"
+,,,
+"org.mockito","mockito-core","2.8.47","48840cfced22ec0c07203a0201c5ae7bc12557b5"
+,,,
+"net.bytebuddy","byte-buddy","1.6.14","871c3e49dc6183d0d361601c2f1d11abb1a6b48c"
+,,,
+"org.objenesis","objenesis","2.5","612ecb799912ccf77cba9b3ed8c813da086076e9"
+,,,
+"org.hamcrest","hamcrest-core","1.3","42a25dc3219429f0e5d060061f71acb49bf010a0"
+,,,
+"org.apache.jena","jena-shaded-guava","3.1.0","6e2400a81e3d6d50a894daa07db0501fc900c659"
Property changes on: trunk/fb-contrib/yank.csv
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Deleted: trunk/fb-contrib/yank.xls
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|