Thread: [Fb-contrib-commit] SF.net SVN: fb-contrib:[1716] trunk/fb-contrib (Page 4)
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2012-10-19 21:52:27
|
Revision: 1716
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1716&view=rev
Author: dbrosius
Date: 2012-10-19 21:52:20 +0000 (Fri, 19 Oct 2012)
Log Message:
-----------
synchronize with github
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/samples/PRMC_Sample.java
trunk/fb-contrib/samples/samples.fbp
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2012-07-04 23:24:26 UTC (rev 1715)
+++ trunk/fb-contrib/.classpath 2012-10-19 21:52:20 UTC (rev 1716)
@@ -16,12 +16,13 @@
<classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-util-3.3.jar"/>
<classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/bcel.jar"/>
<classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/dom4j-1.6.1.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/findbugs.jar"/>
+ <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/findbugs.jar" sourcepath="/findbugs"/>
<classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jaxen-1.1.1.jar"/>
<classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jFormatString.jar"/>
<classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jsr305.jar"/>
<classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/>
<classpathentry kind="lib" path="samples/lib/backport-concurrent-3.1.jar"/>
- <classpathentry kind="lib" path="samples/lib/commons-collection-${commons-collection.version}.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
+ <classpathentry kind="lib" path="samples/lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2012-07-04 23:24:26 UTC (rev 1715)
+++ trunk/fb-contrib/build.xml 2012-10-19 21:52:20 UTC (rev 1716)
@@ -43,8 +43,8 @@
<property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar" />
<property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar" />
<property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar" />
- <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-concurrent.version}/backport-util-concurrent-${backport-concurrent.version}.jar" />
- <property name="commons-collection-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" />
+ <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-concurrent/backport-concurrent/${backport-concurrent.version}/backport-concurrent-${backport-concurrent.version}.jar" />
+ <property name="commons-collections-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" />
<target name="check">
<available file="${dest}/${name}-${version}.jar" property="jar-exists" />
@@ -81,7 +81,7 @@
<pull url="${log4j-url}" dest="${sampleslib.dir}" name="log4j" version="${log4j.version}" />
<pull url="${servlet-api-url}" dest="${sampleslib.dir}" name="servlet-api" version="${servlet-api.version}" />
<pull url="${backport-concurrent-url}" dest="${sampleslib.dir}" name="backport-concurrent" version="${backport-concurrent.version}" />
- <pull url="${commons-collection-url}" dest="${sampleslib.dir}" name="commons-collection" version="${commons-collection.version}" />
+ <pull url="${commons-collections-url}" dest="${sampleslib.dir}" name="commons-collections" version="${commons-collections.version}" />
</target>
<target name="clean" description="removes all generated collateral">
@@ -105,7 +105,7 @@
<mkdir dir="${javadoc.dir}" />
<path id="fb-contrib.classpath">
<pathelement location="${lib.dir}/findbugs-${findbugs.version}.jar" />
- <pathelement location="${lib.dir}/bcel-${findbugs-bcel.version}.jar" />
+ <pathelement location="${lib.dir}/findbugs-bcel-${findbugs-bcel.version}.jar" />
<pathelement location="${lib.dir}/annotations-${annotations.version}.jar" />
<pathelement location="${lib.dir}/asm-tree-${asm-tree.version}.jar" />
</path>
@@ -116,7 +116,7 @@
<pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar" />
<pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
<pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
- <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-concurrent.version}.jar" />
+ <pathelement location="${sampleslib.dir}/backport-concurrent-${backport-concurrent.version}.jar" />
</path>
<mkdir dir="${classes.dir}/com" />
<mkdir dir="${classes.dir}/com/mebigfatguy" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2012-07-04 23:24:26 UTC (rev 1715)
+++ trunk/fb-contrib/etc/findbugs.xml 2012-10-19 21:52:20 UTC (rev 1716)
@@ -234,6 +234,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers" speed="fast" reports="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_THROWS" />
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -406,4 +408,6 @@
<BugPattern abbrev="CSBTS" type="CSBTS_COMMONS_STRING_BUILDER_TOSTRING" category="CORRECTNESS" />
<BugPattern abbrev="CCNE" type="CCNE_COMPARE_CLASS_EQUALS_NAME" category="CORRECTNESS" />
<BugPattern abbrev="BRPI" type="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" category ="PERFORMANCE" />
+ <BugPattern abbrev="CU" type="CU_CLONE_USABILITY_OBJECT_RETURN" category="STYLE" />
+ <BugPattern abbrev="CU" type="CU_CLONE_USABILITY_THROWS" category="STYLE" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2012-07-04 23:24:26 UTC (rev 1715)
+++ trunk/fb-contrib/etc/messages.xml 2012-10-19 21:52:20 UTC (rev 1716)
@@ -1271,6 +1271,17 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability">
+ <Details>
+ <![CDATA[
+ <p> Looks for classes that implement clone() that do not specialize the return value, and do
+ not swallow CloneNotFoundException. Not doing so makes the clone method not as simple to use,
+ and should be harmless to do so.
+ </p>
+ ]]>
+ </Details>
+ </Detector>
+
<!-- BugPattern -->
<BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING">
@@ -3447,14 +3458,42 @@
<LongDescription>Method {1} backport concurrency utils</LongDescription>
<Details>
<![CDATA[
- <p> Detects use of Backport Utils concurrent classes. Updated/Efficient version of these
+ <p> This class usees Backport Utils concurrent classes. Updated/Efficient version of these
classes are available in versions of the JDK 5.0 and higher, and these
classes should only be used if you are targeting JDK 1.4 and lower.
</p>
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="CU_CLONE_USABILITY_OBJECT_RETURN">
+ <ShortDescription>Clone method declares it returns an Object</ShortDescription>
+ <LongDescription>Clone method {1} declares it returns an Object</LongDescription>
+ <Details>
+ <![CDATA[
+ <p> This class implements the Cloneable interface but defines its clone method to return an
+ Object. Since most likely users of this method will need to cast it to the real type, this will
+ be more painful than necessary. Just declare the return value to be the type of this class.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+ <BugPattern type="CU_CLONE_USABILITY_THROWS">
+ <ShortDescription>Clone method declares it throws CloneNotSupportedException</ShortDescription>
+ <LongDescription>Clone method {1} declares it throws CloneNotSupportedException</LongDescription>
+ <Details>
+ <![CDATA[
+ <p> This class implements the Cloneable interface but defines its clone method to still return
+ a CloneNotSupportedException. Since you are implementing clone() it would make sense that the method
+ in question will _not_ throw that exception, so annotating your method with it just makes client use
+ of your more painful as they have to handle an exception that will never happen. Just remove the
+ throws clause from your method.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<!-- BugCode -->
<BugCode abbrev="ISB">Inefficient String Buffering</BugCode>
@@ -3562,4 +3601,5 @@
<BugCode abbrev="CSBTS">Commons ToStringBuilder To String</BugCode>
<BugCode abbrev="CCNE">Compare class name equals</BugCode>
<BugCode abbrev="BRPI">Backport concurrent reuse of public identifiers</BugCode>
+ <BugCode abbrev="CU">Clone Usability</BugCode>
</MessageCollection>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2012-07-04 23:24:26 UTC (rev 1715)
+++ trunk/fb-contrib/htdocs/index.shtml 2012-10-19 21:52:20 UTC (rev 1716)
@@ -118,6 +118,11 @@
classes should only be used if you are targeting JDK 1.4 and lower.<br/>
<span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span>
</li>
+ <li><b>[CU] Clone Usability</b><br/>
+ Looks for classes that implement clone() that do not specialize the return value, and do
+ not swallow CloneNotFoundException. Not doing so makes the clone method not as simple
+ to use, and should be harmless to do.
+ </li>
</ul>
</div>
<hr/>
Modified: trunk/fb-contrib/samples/PRMC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/PRMC_Sample.java 2012-07-04 23:24:26 UTC (rev 1715)
+++ trunk/fb-contrib/samples/PRMC_Sample.java 2012-10-19 21:52:20 UTC (rev 1716)
@@ -1,12 +1,14 @@
import java.nio.ByteBuffer;
import java.util.Calendar;
import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
@SuppressWarnings("all")
-public class PRMC_Sample
+public class PRMC_Sample
{
String data;
-
+
public boolean test1(Calendar c)
{
Date d = c.getTime();
@@ -15,23 +17,23 @@
long j = e.getTime();
return l == j;
}
-
+
public void rmcFP(ByteBuffer bb)
{
int i = bb.getInt();
int j = bb.getInt();
}
-
+
@Override
public boolean equals(Object o)
{
PRMC_Sample rmc = (PRMC_Sample)o;
if (data.equals("INF") || rmc.data.equals("INF"))
return false;
-
+
return data.equals(rmc.data);
}
-
+
public void staticPRMC()
{
Factory.getInstance().fee();
@@ -39,43 +41,55 @@
Factory.getInstance().fo();
Factory.getInstance().fum();
}
-
+
static class Factory
{
private static Factory f = new Factory();
-
+
private Factory()
{
}
-
+
public static Factory getInstance()
{
return f;
}
-
+
public void fee()
{
}
-
+
public void fi()
{
}
-
+
public void fo()
{
}
-
+
public void fum()
{
}
}
-
+
public long fpCurrentTimeMillis(Object o)
{
long time = -System.currentTimeMillis();
o.hashCode();
time += System.currentTimeMillis();
-
+
return time;
}
+
+ public void fpEnumToString(FPEnum e)
+ {
+ Set<String> s = new HashSet<String>();
+
+ s.add(FPEnum.fee.toString());
+ s.add(FPEnum.fi.toString());
+ s.add(FPEnum.fo.toString());
+ s.add(FPEnum.fum.toString());
+ }
+
+ enum FPEnum { fee, fi, fo, fum };
}
Modified: trunk/fb-contrib/samples/samples.fbp
===================================================================
--- trunk/fb-contrib/samples/samples.fbp 2012-07-04 23:24:26 UTC (rev 1715)
+++ trunk/fb-contrib/samples/samples.fbp 2012-10-19 21:52:20 UTC (rev 1716)
@@ -1,12 +1,11 @@
-<Project projectName="">
+<Project projectName="sample">
<Jar>.</Jar>
- <AuxClasspathEntry>./lib/jsp-api.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./lib/junit.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./lib/log4j.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./lib/servlet-api.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./lib/jsp-api-2.2.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./lib/junit-4.10.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./lib/log4j-1.2.16.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./lib/servlet-api-3.0.1.jar</AuxClasspathEntry>
<SrcDir>.</SrcDir>
<SuppressionFilter>
<LastVersion value="-1" relOp="NEQ"/>
</SuppressionFilter>
- <Cloud id="1"></Cloud>
</Project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-10-19 22:01:51
|
Revision: 1717
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1717&view=rev
Author: dbrosius
Date: 2012-10-19 22:01:45 +0000 (Fri, 19 Oct 2012)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2012-10-19 21:52:20 UTC (rev 1716)
+++ trunk/fb-contrib/etc/messages.xml 2012-10-19 22:01:45 UTC (rev 1717)
@@ -1275,7 +1275,7 @@
<Details>
<![CDATA[
<p> Looks for classes that implement clone() that do not specialize the return value, and do
- not swallow CloneNotFoundException. Not doing so makes the clone method not as simple to use,
+ not swallow CloneNotSupportedException. Not doing so makes the clone method not as simple to use,
and should be harmless to do so.
</p>
]]>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2012-10-19 21:52:20 UTC (rev 1716)
+++ trunk/fb-contrib/htdocs/index.shtml 2012-10-19 22:01:45 UTC (rev 1717)
@@ -120,7 +120,7 @@
</li>
<li><b>[CU] Clone Usability</b><br/>
Looks for classes that implement clone() that do not specialize the return value, and do
- not swallow CloneNotFoundException. Not doing so makes the clone method not as simple
+ not swallow CloneNotSupportedException. Not doing so makes the clone method not as simple
to use, and should be harmless to do.
</li>
</ul>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-10-19 22:08:45
|
Revision: 1718
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1718&view=rev
Author: dbrosius
Date: 2012-10-19 22:08:38 +0000 (Fri, 19 Oct 2012)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/htdocs/index.shtml
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2012-10-19 22:01:45 UTC (rev 1717)
+++ trunk/fb-contrib/build.xml 2012-10-19 22:08:38 UTC (rev 1718)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.7.0" />
+ <property name="fb-contrib.version" value="4.8.0" />
<property name="findbugs.version" value="2.0.0" />
<property name="findbugs-bcel.version" value="2.0.0" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2012-10-19 22:01:45 UTC (rev 1717)
+++ trunk/fb-contrib/etc/findbugs.xml 2012-10-19 22:08:38 UTC (rev 1718)
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-
+<!--
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
-
+ -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2012-10-19 22:01:45 UTC (rev 1717)
+++ trunk/fb-contrib/htdocs/index.shtml 2012-10-19 22:08:38 UTC (rev 1718)
@@ -72,25 +72,32 @@
<a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.6.1.jar/download">here</a>.</p>
</div>
+ <hr/>
+ <img id="svn_image" src="flip1.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/>
+ Detectors added in svn<br/>
+ <div id="svn" style="display:none;">
+ <ul>
+ <li><b>[CVAA] ContraVariant Array Assignment</b><br/>
+ Looks for contravariant array assignments. Since arrays are mutable data structures, their use
+ must be restricted to covariant or invariant usage.<br/>
+ <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span></li>
+ <li><b>[STB] Stacked Try Blocks</b><br/>
+ Looks for two or more try catch blocks that are consecutive and catch the
+ same kind of exception, and throw the same exception always. These blocks can
+ be coalesced into one.
+ </li>
+ </ul>
+ </div>
<hr/>
- <img id="svn_image" src="flip2.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/>
- Detectors added in svn<br/>
- <div id="svn" style="display:block;">
+ <img id="v4_8_0_image" src="flip2.gif" onClick="toggleBlock('v4_8_0', 'v4_8_0_image');" align="top"/>
+ Detectors added in v4.8.0<br/>
+ <div id="v4_8_0" style="display:block;">
<ul>
- <li><b>[CVAA] ContraVariant Array Assignment</b><br/>
- Looks for contravariant array assignments. Since arrays are mutable data structures, their use
- must be restricted to covariant or invariant usage.<br/>
- <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span></li>
<li><b>[LGO] Lingering Graphics Object</b><br/>
Looks for creation of java.awt.Graphics object that do not have the
.dispose() method called on them when finished. These objects will be cleaned up by
the Garbage collector, bug given the likelyhood 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.</li>
- <li><b>[STB] Stacked Try Blocks</b><br/>
- Looks for two or more try catch blocks that are consecutive and catch the
- same kind of exception, and throw the same exception always. These blocks can
- be coalesced into one.
- </li>
<li><b>[CCNE] Compare Class Name Equals</b><br/>
Looks for code that compares to classes by name, rather than by just comparing the
classes with ==<br/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-10-20 02:17:35
|
Revision: 1720
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1720&view=rev
Author: dbrosius
Date: 2012-10-20 02:17:27 +0000 (Sat, 20 Oct 2012)
Log Message:
-----------
sync from git
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/htdocs/repository.html
trunk/fb-contrib/samples/LEST_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2012-10-19 22:23:05 UTC (rev 1719)
+++ trunk/fb-contrib/build.xml 2012-10-20 02:17:27 UTC (rev 1720)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.8.0" />
+ <property name="fb-contrib.version" value="4.9.0" />
<property name="findbugs.version" value="2.0.0" />
<property name="findbugs-bcel.version" value="2.0.0" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2012-10-19 22:23:05 UTC (rev 1719)
+++ trunk/fb-contrib/etc/findbugs.xml 2012-10-20 02:17:27 UTC (rev 1720)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!--
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
--->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!--
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
--->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!--
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
--->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!--
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
--->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!--
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
- -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2012-10-19 22:23:05 UTC (rev 1719)
+++ trunk/fb-contrib/htdocs/repository.html 2012-10-20 02:17:27 UTC (rev 1720)
@@ -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</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>4.6.1</td></tr>
+ <tr><td><b>Version:</b></td><td>4.8.0</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/samples/LEST_Sample.java
===================================================================
--- trunk/fb-contrib/samples/LEST_Sample.java 2012-10-19 22:23:05 UTC (rev 1719)
+++ trunk/fb-contrib/samples/LEST_Sample.java 2012-10-20 02:17:27 UTC (rev 1720)
@@ -4,7 +4,7 @@
import java.util.Date;
@SuppressWarnings("all")
-public class LEST_Sample
+public class LEST_Sample
{
public Date testLest1(String input)
{
@@ -12,33 +12,33 @@
{
DateFormat df = new SimpleDateFormat("YYYY");
return df.parse(input);
- }
+ }
catch (ParseException pe)
{
throw new IllegalArgumentException(pe.getMessage());
}
}
-
+
public Date testLest2(String input)
{
try
{
DateFormat df = new SimpleDateFormat("YYYY");
return df.parse(input);
- }
+ }
catch (ParseException pe)
{
throw new IllegalArgumentException(pe.getMessage(), pe);
}
}
-
+
public Date testLestFP1(String input) throws ParseException
{
try
{
DateFormat df = new SimpleDateFormat("YYYY");
return df.parse(input);
- }
+ }
catch (ParseException pe)
{
throw pe;
@@ -51,7 +51,7 @@
{
DateFormat df = new SimpleDateFormat("YYYY");
return df.parse(input);
- }
+ }
catch (ParseException pe)
{
IllegalArgumentException iae = new IllegalArgumentException(pe.getMessage());
@@ -59,7 +59,7 @@
throw iae;
}
}
-
+
public void testLestFP3(String s)
{
double d;
@@ -69,11 +69,11 @@
}
catch (NumberFormatException nfe)
{
-
+
}
throw new RuntimeException("ok");
}
-
+
public void testLestFP4(String s) throws Exception
{
double d;
@@ -87,7 +87,7 @@
throw e;
}
}
-
+
public void testLestFP5(String s) throws Exception
{
double d;
@@ -101,7 +101,7 @@
throw e;
}
}
-
+
public void testLestFP6(String s) throws Exception
{
double d;
@@ -114,11 +114,23 @@
throw new Exception("Yikes");
}
}
-
+
+ public void testLestFP7(String s)
+ {
+ try
+ {
+ double d = Double.parseDouble(s);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
private Exception wrap(Exception e) {
return new Exception(e);
}
-
+
private static Exception wrapStatic(Exception e) {
return new Exception(e);
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-10-19 22:23:05 UTC (rev 1719)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-10-20 02:17:27 UTC (rev 1720)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2012 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
@@ -51,42 +51,45 @@
* the original exception within it. Doing this loses the stack history, and where the original
* problem occurred. This makes finding and fixing errors difficult.
*/
-public class LostExceptionStackTrace extends BytecodeScanningDetector
+public class LostExceptionStackTrace extends BytecodeScanningDetector
{
- private static JavaClass throwableClass;
+ private static JavaClass errorClass;
+ private static JavaClass throwableClass;
static {
try {
- throwableClass = Repository.lookupClass("java/lang/Throwable");
+ errorClass = Repository.lookupClass("java/lang/Error");
+ throwableClass = Repository.lookupClass("java/lang/Throwable");
} catch (ClassNotFoundException cnfe) {
- throwableClass = null;
+ errorClass = null;
+ throwableClass = null;
}
}
-
+
private final BugReporter bugReporter;
private OpcodeStack stack;
private CodeException[] exceptions;
private Set<CatchInfo> catchInfos;
private Map<Integer, Boolean> exReg;
private boolean lastWasExitPoint = false;
-
+
/**
* constructs a LEST detector given the reporter to report bugs on
* @param bugReporter the sync of bug reports
- */
+ */
public LostExceptionStackTrace(BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
-
+
/**
* implements the visitor to make sure the jdk is 1.4 or better
- *
+ *
* @param classContext the context object of the currently parsed class
*/
@Override
public void visitClassContext(ClassContext classContext) {
try {
- if (throwableClass != null && !isPre14Class(classContext.getJavaClass())) {
+ if (errorClass != null && throwableClass != null && !isPre14Class(classContext.getJavaClass())) {
stack = new OpcodeStack();
catchInfos = new HashSet<CatchInfo>();
exReg = new HashMap<Integer, Boolean>();
@@ -99,10 +102,10 @@
exReg = null;
}
}
-
+
/**
* looks for methods that contain a catch block and an ATHROW opcode
- *
+ *
* @param code the context object of the current code block
* @param method the context object of the current method
* @return if the class throws exceptions
@@ -112,7 +115,7 @@
{
return false;
}
-
+
CodeException[] ce = code.getExceptionTable();
if (ce == null || ce.length == 0)
{
@@ -125,7 +128,7 @@
/**
* implements the visitor to filter out methods that don't throw exceptions
- *
+ *
* @param obj the context object of the currently parsed code block
*/
@Override
@@ -139,10 +142,10 @@
super.visitCode(obj);
}
}
-
+
/**
* collects all the valid exception objects (ones where start and finish are before the target
- *
+ *
* @param exs the exceptions from the class file
* @return the filtered exceptions
*/
@@ -155,7 +158,7 @@
}
return filteredEx.toArray(new CodeException[filteredEx.size()]);
}
-
+
/**
* implements the visitor to find throwing alternative exceptions from a catch block, without
* forwarding along the original exception
@@ -163,7 +166,7 @@
@Override
public void sawOpcode(int seen) {
boolean markAsValid = false;
-
+
try {
stack.mergeJumps(this);
int pc = getPC();
@@ -185,7 +188,7 @@
removePreviousHandlers(pc);
}
}
-
+
Iterator<CatchInfo> it = catchInfos.iterator();
while (it.hasNext()) {
try {
@@ -204,10 +207,11 @@
if ("<init>".equals(getNameConstantOperand())) {
String className = getClassConstantOperand();
JavaClass exClass = Repository.lookupClass(className);
- if (exClass.instanceOf(throwableClass)) {
+ if (exClass.instanceOf(errorClass) || (exClass.instanceOf(throwableClass))) {
String sig = getSigConstantOperand();
if (sig.indexOf("Exception") >= 0
- || sig.indexOf("Throwable") >= 0) {
+ || sig.indexOf("Throwable") >= 0
+ || sig.indexOf("Error") >= 0) {
markAsValid = true;
break;
}
@@ -219,7 +223,7 @@
if ("initCause".equals(getNameConstantOperand())) {
String className = getClassConstantOperand();
JavaClass exClass = Repository.lookupClass(className);
- if (exClass.instanceOf(throwableClass)) {
+ if (exClass.instanceOf(errorClass)) {
if (stack.getStackDepth() > 1) {
OpcodeStack.Item itm = stack.getStackItem(1);
int reg = itm.getRegisterNumber();
@@ -254,7 +258,7 @@
.addSourceLine(this));
}
it.remove();
- break;
+ break;
}
}
} else if (seen == ASTORE || seen >= ASTORE_0 && seen <= ASTORE_3) {
@@ -263,7 +267,7 @@
catchInfos.clear();
break;
}
-
+
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
int reg = RegisterUtils.getAStoreReg(this, seen);
@@ -282,13 +286,13 @@
removeIndeterminateHandlers(pc);
break;
}
- }
+ }
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
it.remove();
}
}
-
+
lastWasExitPoint = seen >= IRETURN && seen <= RETURN || seen == GOTO || seen == GOTO_W || seen == ATHROW;
}
finally {
@@ -303,7 +307,7 @@
}
}
}
-
+
/** returns whether the method called might be a method that builds an exception using
* the original exception. It does so by looking to see if the method returns an exception,
* and if one of the parameters is the original exception
@@ -317,7 +321,7 @@
if (returnSig.startsWith("L")) {
returnSig = returnSig.substring(1, returnSig.length() - 1);
JavaClass retCls = Repository.lookupClass(returnSig);
- if (retCls.instanceOf(throwableClass)) {
+ if (retCls.instanceOf(errorClass)) {
int numParms = Type.getArgumentTypes(sig).length;
if (stack.getStackDepth() >= numParms) {
for (int p = 0; p < numParms; p++) {
@@ -332,15 +336,15 @@
}
return false;
}
-
+
/** returns whether the class in question was compiled with a jdk less than 1.4
- *
+ *
* @param cls the class to check
* @return whether the class is compiled with a jdk less than 1.4
*/
private boolean isPre14Class(JavaClass cls)
{
- return cls != null && cls.getMajor() < Constants.MAJOR_1_4;
+ return cls != null && cls.getMajor() < Constants.MAJOR_1_4;
}
private void removePreviousHandlers(int pc)
@@ -355,7 +359,7 @@
}
}
}
-
+
private void removeIndeterminateHandlers(int pc)
{
Iterator<CatchInfo> it = catchInfos.iterator();
@@ -367,16 +371,16 @@
}
}
}
-
+
/**
- * looks to update the catchinfo block with the register used for the
+ * looks to update the catchinfo block with the register used for the
* exception variable. If their is a local variable table, but the local
* variable can't be found return false, signifying an empty catch block.
- *
+ *
* @param ci the catchinfo record for the catch starting at this pc
* @param seen the opcode of the currently visited instruction
* @param pc the current pc
- *
+ *
* @return whether the catch block is empty
*/
private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) {
@@ -402,11 +406,11 @@
}
return true;
}
-
+
/**
* add a catch block info record for the catch block that is guessed to be
* in the range of start to finish
- *
+ *
* @param start the handler pc
* @param finish the guessed end of the catch block
*/
@@ -414,34 +418,34 @@
CatchInfo ci = new CatchInfo(start, finish);
catchInfos.add(ci);
}
-
+
private static class CatchInfo {
private final int catchStart;
private int catchFinish;
private int exReg;
-
+
public CatchInfo(int start, int finish) {
catchStart = start;
catchFinish = finish;
exReg = -1;
}
-
+
public void setReg(int reg) {
exReg = reg;
}
-
+
public int getStart() {
return catchStart;
}
-
+
public int getFinish() {
return catchFinish;
}
-
+
public void setFinish(int finish) {
catchFinish = finish;
}
-
+
public int getRegister() {
return exReg;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-10-25 14:11:15
|
Revision: 1721
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1721&view=rev
Author: dbrosius
Date: 2012-10-25 14:11:03 +0000 (Thu, 25 Oct 2012)
Log Message:
-----------
uptake from git
Modified Paths:
--------------
trunk/fb-contrib/samples/LEST_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
Modified: trunk/fb-contrib/samples/LEST_Sample.java
===================================================================
--- trunk/fb-contrib/samples/LEST_Sample.java 2012-10-20 02:17:27 UTC (rev 1720)
+++ trunk/fb-contrib/samples/LEST_Sample.java 2012-10-25 14:11:03 UTC (rev 1721)
@@ -127,6 +127,18 @@
}
}
+ public void testLestFP8()
+ {
+ try
+ {
+ Thread.sleep(10L);
+ }
+ catch (Exception ex)
+ {
+ throw new AssertionError(ex);
+ }
+ }
+
private Exception wrap(Exception e) {
return new Exception(e);
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-10-20 02:17:27 UTC (rev 1720)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-10-25 14:11:03 UTC (rev 1721)
@@ -55,10 +55,13 @@
{
private static JavaClass errorClass;
private static JavaClass throwableClass;
+ private static JavaClass assertionClass;
+
static {
try {
errorClass = Repository.lookupClass("java/lang/Error");
throwableClass = Repository.lookupClass("java/lang/Throwable");
+ assertionClass = Repository.lookupClass("java/lang/AssertionError");
} catch (ClassNotFoundException cnfe) {
errorClass = null;
throwableClass = null;
@@ -215,6 +218,11 @@
markAsValid = true;
break;
}
+ if (exClass.instanceOf(assertionClass)) {
+ //just ignore LEST for AssertionErrors
+ markAsValid = true;
+ break;
+ }
}
} else if (isPossibleExBuilder(catchInfo.getRegister())) {
markAsValid = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-10-25 14:16:38
|
Revision: 1723
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1723&view=rev
Author: dbrosius
Date: 2012-10-25 14:16:26 +0000 (Thu, 25 Oct 2012)
Log Message:
-----------
pull from git
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2012-10-25 14:14:34 UTC (rev 1722)
+++ trunk/fb-contrib/build.xml 2012-10-25 14:16:26 UTC (rev 1723)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.9.0" />
+ <property name="fb-contrib.version" value="4.8.1" />
<property name="findbugs.version" value="2.0.0" />
<property name="findbugs-bcel.version" value="2.0.0" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:14:34 UTC (rev 1722)
+++ trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:16:26 UTC (rev 1723)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-10-25 14:38:24
|
Revision: 1725
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1725&view=rev
Author: dbrosius
Date: 2012-10-25 14:38:17 +0000 (Thu, 25 Oct 2012)
Log Message:
-----------
sync with git
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
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2012-10-25 14:18:50 UTC (rev 1724)
+++ trunk/fb-contrib/build.xml 2012-10-25 14:38:17 UTC (rev 1725)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.8.1" />
+ <property name="fb-contrib.version" value="4.9.0" />
<property name="findbugs.version" value="2.0.0" />
<property name="findbugs-bcel.version" value="2.0.0" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:18:50 UTC (rev 1724)
+++ trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:38:17 UTC (rev 1725)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2012-10-25 14:18:50 UTC (rev 1724)
+++ trunk/fb-contrib/htdocs/index.shtml 2012-10-25 14:38:17 UTC (rev 1725)
@@ -68,8 +68,8 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 4.6.1 available for download
- <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.6.1.jar/download">here</a>.</p>
+ <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.1 available for download
+ <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.1.jar/download">here</a>.</p>
</div>
<hr/>
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2012-10-25 14:18:50 UTC (rev 1724)
+++ trunk/fb-contrib/htdocs/repository.html 2012-10-25 14:38:17 UTC (rev 1725)
@@ -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</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>4.8.0</td></tr>
+ <tr><td><b>Version:</b></td><td>4.8.1</td></tr>
</table>
</div>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-10-25 19:42:13
|
Revision: 1726
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1726&view=rev
Author: dbrosius
Date: 2012-10-25 19:42:06 +0000 (Thu, 25 Oct 2012)
Log Message:
-----------
sync from git
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2012-10-25 14:38:17 UTC (rev 1725)
+++ trunk/fb-contrib/build.xml 2012-10-25 19:42:06 UTC (rev 1726)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.9.0" />
+ <property name="fb-contrib.version" value="4.8.1" />
<property name="findbugs.version" value="2.0.0" />
<property name="findbugs-bcel.version" value="2.0.0" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:38:17 UTC (rev 1725)
+++ trunk/fb-contrib/etc/findbugs.xml 2012-10-25 19:42:06 UTC (rev 1726)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-10-31 17:33:09
|
Revision: 1729
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1729&view=rev
Author: dbrosius
Date: 2012-10-31 17:32:54 +0000 (Wed, 31 Oct 2012)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/samples/CVAA_Sample.java
trunk/fb-contrib/samples/DWI_Sample.java
trunk/fb-contrib/samples/LEST_Sample.java
trunk/fb-contrib/samples/SMII_Sample.java
trunk/fb-contrib/samples/USBR_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/.classpath 2012-10-31 17:32:54 UTC (rev 1729)
@@ -9,17 +9,6 @@
<classpathentry kind="lib" path="samples/lib/junit-4.10.jar"/>
<classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/>
<classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-3.3.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-analysis-3.3.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-commons-3.3.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-tree-3.3.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-util-3.3.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/bcel.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/dom4j-1.6.1.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/findbugs.jar" sourcepath="/findbugs"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jaxen-1.1.1.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jFormatString.jar"/>
- <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jsr305.jar"/>
<classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/>
<classpathentry kind="lib" path="samples/lib/backport-concurrent-3.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/build.xml 2012-10-31 17:32:54 UTC (rev 1729)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.8.1" />
+ <property name="fb-contrib.version" value="4.9.0" />
<property name="findbugs.version" value="2.0.0" />
<property name="findbugs-bcel.version" value="2.0.0" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/etc/findbugs.xml 2012-10-31 17:32:54 UTC (rev 1729)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
@@ -334,7 +334,7 @@
<BugPattern abbrev="SPP" type="SPP_EMPTY_CASING" category="STYLE" />
<BugPattern abbrev="SPP" type="SPP_TEMPORARY_TRIM" category="STYLE" />
<BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" />
- <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" />
+ <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" category="STYLE" />
<BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" />
<BugPattern abbrev="DWI" type="DWI_MODIFYING_WHILE_ITERATING" category="CORRECTNESS" />
<BugPattern abbrev="USS" type="USS_USE_STRING_SPLIT" category="STYLE" />
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/etc/messages.xml 2012-10-31 17:32:54 UTC (rev 1729)
@@ -2547,7 +2547,7 @@
</Details>
</BugPattern>
- <BugPattern type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR">
+ <BugPattern type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR">
<ShortDescription>Class implements interface by relying on unknowing superclass methods</ShortDescription>
<LongDescription>Class {0} implements interface by relying on unknowing superclass methods</LongDescription>
<Details>
Modified: trunk/fb-contrib/samples/CVAA_Sample.java
===================================================================
--- trunk/fb-contrib/samples/CVAA_Sample.java 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/samples/CVAA_Sample.java 2012-10-31 17:32:54 UTC (rev 1729)
@@ -1,13 +1,15 @@
+import java.util.Set;
+
public class CVAA_Sample
{
Base[] b2;
class Base {}
-
+
class Derived extends Base {}
-
+
public void cvaa()
- {
+ {
Derived[] d2 = new Derived[4];
Base[] b = d2;
b2 = d2;
@@ -16,12 +18,16 @@
b[1] = doDerived();
b[2] = null;
b[3] = d;
-
+
Integer[] a = new Integer[1];
System.arraycopy(a[0], 0, a, 1, 1);
}
-
+
private Derived doDerived(){
return new Derived();
}
+
+ public String fpVarArgs(String s1, Set<String> s2) {
+ return String.format("s1=%s s2=%s", s1, s2);
+ }
}
\ No newline at end of file
Modified: trunk/fb-contrib/samples/DWI_Sample.java
===================================================================
--- trunk/fb-contrib/samples/DWI_Sample.java 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/samples/DWI_Sample.java 2012-10-31 17:32:54 UTC (rev 1729)
@@ -3,10 +3,10 @@
import java.util.Iterator;
import java.util.Set;
-public class DWI_Sample
+public class DWI_Sample
{
Set<String> avail;
-
+
public void deleteOdds(Set<Integer> bagOInts)
{
Iterator<Integer> it = bagOInts.iterator();
@@ -17,7 +17,7 @@
bagOInts.remove(i);
}
}
-
+
public void addIf(Set<String> s, Collection<String> c) {
for (String ss : s)
{
@@ -25,7 +25,7 @@
s.addAll(c);
}
}
-
+
public void fpUnaliased()
{
Iterator<String> it = avail.iterator();
@@ -36,7 +36,7 @@
avail.add(it.next() + "booya");
}
}
-
+
public void fpWithBreak(Set<String> ss)
{
for (String s : ss)
@@ -47,4 +47,15 @@
}
}
}
+
+ public void fpClearWithBreak(Set<String> ss)
+ {
+ for (String s : ss)
+ {
+ if (s.equals("foo")) {
+ ss.clear();
+ break;
+ }
+ }
+ }
}
Modified: trunk/fb-contrib/samples/LEST_Sample.java
===================================================================
--- trunk/fb-contrib/samples/LEST_Sample.java 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/samples/LEST_Sample.java 2012-10-31 17:32:54 UTC (rev 1729)
@@ -1,3 +1,4 @@
+import java.io.IOException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -139,6 +140,26 @@
}
}
+ public void testLestFP3510540() throws Exception
+ {
+ boolean bool = true;
+ if (bool)
+ {
+ try
+ {
+ throw new IOException();
+ }
+ catch (IOException ioe)
+ {
+ throw new Exception(ioe);
+ }
+ }
+ else
+ {
+ throw new Exception("message");
+ }
+ }
+
private Exception wrap(Exception e) {
return new Exception(e);
}
Modified: trunk/fb-contrib/samples/SMII_Sample.java
===================================================================
--- trunk/fb-contrib/samples/SMII_Sample.java 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/samples/SMII_Sample.java 2012-10-31 17:32:54 UTC (rev 1729)
@@ -6,72 +6,82 @@
public class SMII_Sample
{
private Inner i = new Inner();
-
+
public static void static_empty()
{
}
-
+
public static void static_one(String s)
{
}
-
+
public void test_empty(SMII_Sample smii)
{
smii.static_empty();
}
-
+
public void test_empty2(SMII_Sample smii)
{
smii.static_one("foo".toUpperCase());
}
-
- public SMII_Sample getSMI()
+
+ public SMII_Sample getSMI()
{
return new SMII_Sample();
}
-
+
public void test_chaining()
{
new SMII_Sample().getSMI().static_one("hello");
}
-
+
public void test_dotclass()
{
Set s = new HashSet();
s.add(String.class);
}
-
+
public void test_ClassForName() throws ClassNotFoundException
{
Class c = Class.forName("java.lang.Object");
}
-
+
public void test_ClassGetName()
{
String name = Object.class.getName();
}
-
+
public void avoidGeneratedMethods(final Inner inner)
{
inner.next = null;
}
-
+
public static class Inner
{
- private Inner next;
+ private Inner next;
}
-
- public void testFPInstance(SMII_Sample sample)
+
+ public static SMII_Sample fp1()
{
+ SMII_Sample s = new SMII_Sample();
+
+ SMII_Sample.fp1();
+ SMII_Sample.fp1();
+
+ return s;
+ }
+
+ public void testFP2Instance(SMII_Sample sample)
+ {
SMII_Sample.testInstanceAsFirstParm(sample, "");
SMII_Sample.testInstanceAsFirstParm("");
}
-
+
public static SMII_Sample testInstanceAsFirstParm(String s1)
{
return new SMII_Sample();
}
-
+
public static SMII_Sample testInstanceAsFirstParm(SMII_Sample sample, String s1)
{
return sample;
Modified: trunk/fb-contrib/samples/USBR_Sample.java
===================================================================
--- trunk/fb-contrib/samples/USBR_Sample.java 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/samples/USBR_Sample.java 2012-10-31 17:32:54 UTC (rev 1729)
@@ -10,17 +10,17 @@
{
sum += Integer.parseInt(s);
}
-
+
int ave = sum / tokens.length;
return ave;
}
-
+
public int dontReport(int j)
{
int i;
try
{
- i = 0;
+ i = 0;
i = i / j;
}
catch (Exception e)
@@ -29,7 +29,7 @@
}
return i;
}
-
+
public Exception fpReturnException(String num)
{
try
@@ -42,7 +42,7 @@
return e;
}
}
-
+
public int fpPlusEquals()
{
int i = 0;
@@ -50,4 +50,10 @@
i+= dontReport(i);
return i;
}
+
+ public boolean fpOrEquals(boolean b)
+ {
+ b |= fpOrEquals(b);
+ return b;
+ }
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-10-31 17:32:54 UTC (rev 1729)
@@ -70,7 +70,7 @@
/**
* constructs a BAS detector given the reporter to report bugs on
- *
+ *
* @param bugReporter
* the sync of bug reports
*/
@@ -81,7 +81,7 @@
/**
* implements the visitor to create and the clear the register to location
* map
- *
+ *
* @param classContext
* the context object of the currently parsed class
*/
@@ -105,7 +105,7 @@
/**
* implements the visitor to reset the register to location map
- *
+ *
* @param obj
* the context object of the currently parsed code block
*/
@@ -152,7 +152,7 @@
/**
* implements the visitor to look for variables assigned below the scope in
* which they are used.
- *
+ *
* @param seen
* the opcode of the currently parsed instruction
*/
@@ -372,7 +372,7 @@
/**
* returns either a register number of a field reference of the object that
* a method is being called on, or null, if it can't be determined.
- *
+ *
* @return either an Integer for a register, or a String for the field name,
* or null
*/
@@ -407,7 +407,7 @@
/**
* returns the scope block in which this register was assigned, by
* traversing the scope block tree
- *
+ *
* @param sb
* the scope block to start searching in
* @param pc
@@ -433,12 +433,12 @@
/**
* returns an existing scope block that has the same target as the one
* looked for
- *
+ *
* @param sb
* the scope block to start with
* @param target
* the target to look for
- *
+ *
* @return the scope block found or null
*/
private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start,
@@ -479,7 +479,7 @@
/**
* construts a new scope block
- *
+ *
* @param start
* the beginning of the block
* @param finish
@@ -499,7 +499,7 @@
/**
* returns a string representation of the scope block
- *
+ *
* @returns a string representation
*/
@Override
@@ -511,7 +511,7 @@
/**
* returns the scope blocks parent
- *
+ *
* @return the parent of this scope block
*/
public ScopeBlock getParent() {
@@ -520,7 +520,7 @@
/**
* returns the start of the block
- *
+ *
* @return the start of the block
*/
public int getStart() {
@@ -529,7 +529,7 @@
/**
* returns the end of the block
- *
+ *
* @return the end of the block
*/
public int getFinish() {
@@ -538,7 +538,7 @@
/**
* sets the start pc of the block
- *
+ *
* @param start
* the start pc
*/
@@ -548,7 +548,7 @@
/**
* sets the finish pc of the block
- *
+ *
* @param finish
* the finish pc
*/
@@ -569,7 +569,7 @@
/**
* returns whether this scope block is a loop
- *
+ *
* @returns whether this block is a loop
*/
public boolean isLoop() {
@@ -585,7 +585,7 @@
/**
* returns whether this block was caused from a goto
- *
+ *
* @returns whether this block was caused by a goto
*/
public boolean isGoto() {
@@ -594,7 +594,7 @@
/**
* adds the register as a store in this scope block
- *
+ *
* @param reg
* the register that was stored
* @param pc
@@ -615,7 +615,7 @@
/**
* removes stores to registers that where retrieved from method calls on
* assocObject
- *
+ *
* @param assocObject
* the object that a method call was just performed on
*/
@@ -635,7 +635,7 @@
/**
* adds the register as a load in this scope block
- *
+ *
* @param reg
* the register that was loaded
* @param pc
@@ -652,7 +652,7 @@
/**
* adds a scope block to this subtree by finding the correct place in
* the hierarchy to store it
- *
+ *
* @param newChild
* the scope block to add to the tree
*/
@@ -684,7 +684,7 @@
/**
* removes a child from this node
- *
+ *
* @param child
* the child to remove
*/
@@ -760,10 +760,10 @@
/**
* returns whether this block either loads or stores into the register
* in question
- *
+ *
* @param reg
* the register to look for loads or stores
- *
+ *
* @return whether the block uses the register
*/
public boolean usesReg(Integer reg) {
@@ -823,7 +823,7 @@
return dangerousAssignmentMethodSources.contains(key);
}
- class UserObject {
+ static class UserObject {
Comparable<?> caller;
boolean isRisky;
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2012-10-31 17:32:54 UTC (rev 1729)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2012 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
@@ -87,7 +87,7 @@
/**
* overrides the visitor to collect package and class names
- *
+ *
* @param classContext the context object that holds the JavaClass being parsed
*/
@Override
@@ -106,7 +106,7 @@
/**
* overrides the visitor to check whether the method is static
- *
+ *
* @param obj the method currently being parsed
*/
@Override
@@ -118,7 +118,7 @@
/**
* overrides the visitor to look for the method that uses another class the most, and
* if it exceeds the threshold reports it
- *
+ *
* @param obj the code that is currently being parsed
*/
@Override
@@ -147,11 +147,11 @@
if (bestEnvyCount < envyMin) {
return;
}
- String bestEnvy = bestEnvyEntry.getKey();
double bestPercent = ((double)bestEnvyCount) / ((double) (bestEnvyCount + thisClsAccessCount));
if (bestPercent > envyPercent) {
+ String bestEnvy = bestEnvyEntry.getKey();
if (implementsCommonInterface(bestEnvy)) {
return;
}
@@ -168,7 +168,7 @@
/**
* overrides the visitor to look for method calls, and populate a class access count map
* based on the owning class of methods called.
- *
+ *
* @param seen the opcode currently being parsed
*/
@Override
@@ -204,9 +204,9 @@
/**
* return whether or not a class implements a common or marker interface
- *
+ *
* @param name the class name to check
- *
+ *
* @return if this class implements a common or marker interface
*/
private boolean implementsCommonInterface(String name) {
@@ -233,9 +233,9 @@
/**
* increment the count of class access of the class on the stack
- *
+ *
* @param classAtStackIndex the position on the stack of the class in question
- *
+ *
* @return true if the class is counted
*/
private boolean countClassAccess(final int classAtStackIndex) {
@@ -261,7 +261,7 @@
/**
* increment the count of class access of the specified class if it is in a similar
* package to the caller, and is not general purpose
- *
+ *
* @param calledClass the class to check
*/
private void countClassAccess(final String calledClass) {
@@ -284,7 +284,7 @@
/**
* add the current line number to a set of line numbers
- *
+ *
* @param lineNumbers the current set of line numbers
*/
private void addLineNumber(Set<Integer> lineNumbers) {
@@ -303,9 +303,9 @@
/**
* checks to see if the specified class is a built in class, or implements a simple interface
- *
+ *
* @param className the class in question
- *
+ *
* @return whether or not the class is general purpose
*/
private boolean generalPurpose(final String className) {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-10-31 17:32:54 UTC (rev 1729)
@@ -2,17 +2,17 @@
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2012 Bhaskar Maddala
* Copyright (C) 2005-2012 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
@@ -31,13 +31,13 @@
* In a JVM, Two classes are the same class (and consequently the same type) if
* they are loaded by the same class loader, and they have the same fully
* qualified name [JVMSpec 1999].
- *
+ *
* Two classes with the same name but different package names are distinct, as
* are two classes with the same fully qualified name loaded by different class
* loaders.
- *
+ *
* Find usage involving comparison of class names, rather than the class itself.
- *
+ *
*/
public class CompareClassNameEquals extends OpcodeStackDetector {
private boolean flag = false;
@@ -76,7 +76,7 @@
&& "java/lang/String".equals(getClassConstantOperand())) {
Item item = stack.getItemMethodInvokedOn(this);
Object userValue = item.getUserValue();
- if (userValue != null && userValue == Boolean.TRUE) {
+ if (userValue != null && Boolean.TRUE.equals(userValue)) {
bugReporter
.reportBug(new BugInstance(this,
"CCNE_COMPARE_CLASS_EQUALS_NAME",
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-10-25 19:46:23 UTC (rev 1728)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-10-31 17:32:54 UTC (rev 1729)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2012 Bhaskar Maddala
- *
+ *
* 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
@@ -33,18 +33,18 @@
import edu.umd.cs.findbugs.OpcodeStack;
/**
- * Finds contravariant array assignments. Since arrays are mutable data structures, their use
+ * Finds contravariant array assignments. Since arrays are mutable data structures, their use
* must be restricted to covariant or invariant usage
- *
+ *
* <pre>
* class A {}
* class B extends A {}
- *
+ *
* B[] b = new B[2];
* A[] a = b;
* a[0] = new A(); // results in ArrayStoreException (Runtime)
* </pre>
- *
+ *
* Contravariant array assignments are reported as low or normal priority bugs. In cases
* where the detector can determine an ArrayStoreException the bug is reported with high priority.
*
@@ -52,7 +52,7 @@
public class ContraVariantArrayAssignment extends BytecodeScanningDetector {
private final BugReporter bugReporter;
private final OpcodeStack stack;
-
+
/**
* constructs a CVAA detector given the reporter to report bugs on.
@@ -65,9 +65,9 @@
/**
* implements the visitor to pass through constructors and static initializers to the
- * byte code scanning code. These methods are not reported, but are used to build
+ * byte code scanning code. These methods are not reported, but are used to build
* SourceLineAnnotations for fields, if accessed.
- *
+ *
* @param obj the context object of the currently parsed code attribute
*/
@Override
@@ -81,7 +81,7 @@
@Override
public void sawOpcode(int seen) {
- try{
+ try{
switch(seen){
case ASTORE:
case ASTORE_0:
@@ -102,23 +102,24 @@
case PUTFIELD:
case PUTSTATIC:
if(stack.getStackDepth() > 0){
- OpcodeStack.Item item = stack.getStackItem(0);
+ OpcodeStack.Item item = stack.getStackItem(0);
String sourceSignature = item.getSignature();
String targetSignature = getSigConstantOperand();
checkSignatures(sourceSignature, targetSignature);
}
break;
case AASTORE:
+/*
OpcodeStack.Item arrayref = stack.getStackItem(2);
OpcodeStack.Item value = stack.getStackItem(0);
-
+
if(!value.isNull()) {
- St...
[truncated message content] |
|
From: <dbr...@us...> - 2012-11-22 01:44:02
|
Revision: 1730
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1730&view=rev
Author: dbrosius
Date: 2012-11-22 01:43:55 +0000 (Thu, 22 Nov 2012)
Log Message:
-----------
sync with github
Modified Paths:
--------------
trunk/fb-contrib/.project
trunk/fb-contrib/build.properties
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples/CVAA_Sample.java
trunk/fb-contrib/samples/UNNC_Sample.java
trunk/fb-contrib/samples/UVA_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
Modified: trunk/fb-contrib/.project
===================================================================
--- trunk/fb-contrib/.project 2012-10-31 17:32:54 UTC (rev 1729)
+++ trunk/fb-contrib/.project 2012-11-22 01:43:55 UTC (rev 1730)
@@ -32,4 +32,15 @@
<nature>org.eclipse.pde.PluginNature</nature>
<nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
</natures>
+ <filteredResources>
+ <filter>
+ <id>1351977185587</id>
+ <name>samples</name>
+ <type>10</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-name-matches-false-false-.svn</arguments>
+ </matcher>
+ </filter>
+ </filteredResources>
</projectDescription>
Modified: trunk/fb-contrib/build.properties
===================================================================
--- trunk/fb-contrib/build.properties 2012-10-31 17:32:54 UTC (rev 1729)
+++ trunk/fb-contrib/build.properties 2012-11-22 01:43:55 UTC (rev 1730)
@@ -4,5 +4,6 @@
.
jars.compile.order = .
source.. = src/,\
- etc/
-output.. = bin/
+ etc/,\
+ samples/
+output.. = classes/
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2012-10-31 17:32:54 UTC (rev 1729)
+++ trunk/fb-contrib/pom.xml 2012-11-22 01:43:55 UTC (rev 1730)
@@ -91,7 +91,7 @@
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>findbugs</artifactId>
- <version>1.3.9</version>
+ <version>2.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Modified: trunk/fb-contrib/samples/CVAA_Sample.java
===================================================================
--- trunk/fb-contrib/samples/CVAA_Sample.java 2012-10-31 17:32:54 UTC (rev 1729)
+++ trunk/fb-contrib/samples/CVAA_Sample.java 2012-11-22 01:43:55 UTC (rev 1730)
@@ -1,3 +1,4 @@
+import java.util.HashSet;
import java.util.Set;
@@ -27,7 +28,12 @@
return new Derived();
}
+ public void generics() {
+ Set<String>[] myStringSets = new HashSet[2];
+ Set<String>[] myStringSets2 = new Set[2];
+ }
+
public String fpVarArgs(String s1, Set<String> s2) {
return String.format("s1=%s s2=%s", s1, s2);
}
-}
\ No newline at end of file
+}
Modified: trunk/fb-contrib/samples/UNNC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/UNNC_Sample.java 2012-10-31 17:32:54 UTC (rev 1729)
+++ trunk/fb-contrib/samples/UNNC_Sample.java 2012-11-22 01:43:55 UTC (rev 1730)
@@ -5,8 +5,7 @@
public class UNNC_Sample {
-
- @SuppressWarnings("null")
+
public void testPosNEW()
{
UNNC_Sample sample = new UNNC_Sample();
@@ -16,7 +15,6 @@
}
}
- @SuppressWarnings("null")
public void testNegNEW()
{
UNNC_Sample sample = new UNNC_Sample();
@@ -28,7 +26,6 @@
System.out.println("OK");
}
- @SuppressWarnings("null")
public void testPosANEWARAY()
{
String[] s = new String[10];
@@ -37,7 +34,6 @@
}
}
- @SuppressWarnings("null")
public void testNegANEWARRAY()
{
String[] s = new String[10];
@@ -48,7 +44,6 @@
System.out.println("OK");
}
- @SuppressWarnings("null")
public void testPosMULTIANEWARRAY()
{
String[][] s = new String[10][5];
@@ -57,7 +52,6 @@
}
}
- @SuppressWarnings("null")
public void testNegMULTIANEWARRAY()
{
String[][] s = new String[10][5];
Modified: trunk/fb-contrib/samples/UVA_Sample.java
===================================================================
--- trunk/fb-contrib/samples/UVA_Sample.java 2012-10-31 17:32:54 UTC (rev 1729)
+++ trunk/fb-contrib/samples/UVA_Sample.java 2012-11-22 01:43:55 UTC (rev 1730)
@@ -4,35 +4,37 @@
public class UVA_Sample<T> extends ArrayList<T>
{
- public void testNormalUVA(String[] foo)
+ private static final long serialVersionUID = -7860932685876390245L;
+
+ public void testNormalUVA(String[] foo)
{}
-
+
public void testLowUVA1(int boo, String[] hoo)
{}
-
+
public static void testStaticUVA(Date[] d)
{}
-
+
public void fpNoParms()
{}
-
+
public void fpHasOtherArrayUVA1(String[] one, int[] two)
{}
-
+
public void fpTooManyArgs(int i, char j, long k, String[] moo)
{}
-
+
public void fpNotAtEnd(String[] foo, int bar)
{}
-
+
public void fpAlreadyVarArg(String...darnit)
{}
-
+
public void fpSimilarVarArg(String info, String...data)
{}
-
+
@Override
- public <T> T[] toArray(T[] a)
+ public <E> E[] toArray(E[] a)
{
return null;
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2012-10-31 17:32:54 UTC (rev 1729)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2012-11-22 01:43:55 UTC (rev 1730)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2012 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
@@ -27,23 +27,23 @@
public class CollectStatistics extends BytecodeScanningDetector implements NonReportingDetector
{
private int numMethodCalls;
-
- public CollectStatistics(@SuppressWarnings("unused") BugReporter bugReporter) {
+
+ public CollectStatistics(BugReporter bugReporter) {
Statistics.getStatistics().clear();
}
-
+
@Override
public void visitCode(Code obj) {
-
+
numMethodCalls = 0;
-
+
byte[] code = obj.getCode();
if (code != null) {
super.visitCode(obj);
Statistics.getStatistics().addMethodStatistics(getClassName(), getMethodName(), getMethodSig(), new Statistics.MethodInfo(code.length, numMethodCalls));
}
}
-
+
@Override
public void sawOpcode(int seen) {
switch (seen) {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2012-10-31 17:32:54 UTC (rev 1729)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2012-11-22 01:43:55 UTC (rev 1730)
@@ -142,15 +142,17 @@
}
if ((seen == INVOKEINTERFACE) || (seen == INVOKEVIRTUAL) || ((seen == INVOKESPECIAL))) {
//ignore possible method chaining
- OpcodeStack.Item item = stack.getStackItem(types.length);
- Integer allocation = (Integer)item.getUserValue();
- if (allocation != null) {
- String retType = Type.getReturnType(signature).getSignature();
- if (!"V".equals(retType) && retType.equals(item.getSignature())) {
- sawAllocationNumber = allocation;
- sawAllocation = true;
+ if (stack.getStackDepth() > types.length) {
+ OpcodeStack.Item item = stack.getStackItem(types.length);
+ Integer allocation = (Integer)item.getUserValue();
+ if (allocation != null) {
+ String retType = Type.getReturnType(signature).getSignature();
+ if (!"V".equals(retType) && retType.equals(item.getSignature())) {
+ sawAllocationNumber = allocation;
+ sawAllocation = true;
+ }
}
- }
+ }
}
}
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-11-22 19:51:41
|
Revision: 1732
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1732&view=rev
Author: dbrosius
Date: 2012-11-22 19:51:34 +0000 (Thu, 22 Nov 2012)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2012-11-22 02:21:35 UTC (rev 1731)
+++ trunk/fb-contrib/.classpath 2012-11-22 19:51:34 UTC (rev 1732)
@@ -10,8 +10,8 @@
<classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/>
<classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/>
<classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/>
- <classpathentry kind="lib" path="samples/lib/backport-concurrent-3.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
<classpathentry kind="lib" path="samples/lib/commons-collections-3.2.1.jar"/>
+ <classpathentry kind="lib" path="samples/lib/backport-util-concurrent-3.1.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2012-11-22 02:21:35 UTC (rev 1731)
+++ trunk/fb-contrib/build.xml 2012-11-22 19:51:34 UTC (rev 1732)
@@ -35,7 +35,7 @@
<property name="junit.version" value="4.10" />
<property name="log4j.version" value="1.2.16" />
<property name="servlet-api.version" value="3.0.1" />
- <property name="backport-concurrent.version" value="3.1" />
+ <property name="backport-util-concurrent.version" value="3.1" />
<property name="commons-collections.version" value="3.2.1" />
<property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar" />
@@ -43,7 +43,7 @@
<property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar" />
<property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar" />
<property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar" />
- <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-concurrent/backport-concurrent/${backport-concurrent.version}/backport-concurrent-${backport-concurrent.version}.jar" />
+ <property name="backport-util-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-util-concurrent.version}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
<property name="commons-collections-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" />
<target name="check">
@@ -80,7 +80,7 @@
<pull url="${junit-url}" dest="${sampleslib.dir}" name="junit" version="${junit.version}" />
<pull url="${log4j-url}" dest="${sampleslib.dir}" name="log4j" version="${log4j.version}" />
<pull url="${servlet-api-url}" dest="${sampleslib.dir}" name="servlet-api" version="${servlet-api.version}" />
- <pull url="${backport-concurrent-url}" dest="${sampleslib.dir}" name="backport-concurrent" version="${backport-concurrent.version}" />
+ <pull url="${backport-util-concurrent-url}" dest="${sampleslib.dir}" name="backport-util-concurrent" version="${backport-util-concurrent.version}" />
<pull url="${commons-collections-url}" dest="${sampleslib.dir}" name="commons-collections" version="${commons-collections.version}" />
</target>
@@ -116,7 +116,7 @@
<pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar" />
<pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
<pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
- <pathelement location="${sampleslib.dir}/backport-concurrent-${backport-concurrent.version}.jar" />
+ <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
</path>
<mkdir dir="${classes.dir}/com" />
<mkdir dir="${classes.dir}/com/mebigfatguy" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2012-12-30 08:44:35
|
Revision: 1735
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1735&view=rev
Author: dbrosius
Date: 2012-12-30 08:44:25 +0000 (Sun, 30 Dec 2012)
Log Message:
-----------
sync from git
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples/BAS_Sample.java
trunk/fb-contrib/samples/CCNE_Sample.java
trunk/fb-contrib/samples/MRC_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/build.xml 2012-12-30 08:44:25 UTC (rev 1735)
@@ -18,10 +18,13 @@
<property name="javac.debug" value="on" />
<property name="fb-contrib.version" value="4.9.0" />
+
+ <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
+
- <property name="findbugs.version" value="2.0.0" />
- <property name="findbugs-bcel.version" value="2.0.0" />
- <property name="annotations.version" value="2.0.0" />
+ <property name="findbugs.version" value="2.0.1" />
+ <property name="findbugs-bcel.version" value="2.0.1" />
+ <property name="annotations.version" value="2.0.1" />
<property name="asm-tree.version" value="3.3.1" />
<property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar" />
@@ -221,4 +224,38 @@
<target name="release" depends="build, srczip, html, javadoc" description="prepares everything for a release" />
+ <target name="sonatype" depends="release" description="prepare an artifact bundle for sonatype">
+ <mkdir dir="${sonatype.dir}"/>
+ <copy todir="${sonatype.dir}" file="${basedir}/fb-contrib-${fb-contrib.version}.jar"/>
+ <copy tofile="${sonatype.dir}/fb-contrib-${fb-contrib.version}-sources.jar" file="${basedir}/fb-contrib-src-${fb-contrib.version}.zip"/>
+ <jar destfile="${sonatype.dir}/fb-contrib-${fb-contrib.version}-javadoc.jar" basedir="${basedir}" includes="javadoc/**"/>
+ <copy tofile="${sonatype.dir}/fb-contrib-${fb-contrib.version}.pom" file="${basedir}/pom.xml"/>
+
+ <exec executable="gpg">
+ <arg value="-abi" />
+ <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}.jar" />
+ </exec>
+ <exec executable="gpg">
+ <arg value="-abi" />
+ <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}.pom" />
+ </exec>
+ <exec executable="gpg">
+ <arg value="-abi" />
+ <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}-sources.jar" />
+ </exec>
+ <exec executable="gpg">
+ <arg value="-abi" />
+ <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}-javadoc.jar" />
+ </exec>
+ <jar destfile="${sonatype.dir}/bundle.jar" basedir="${sonatype.dir}" includes="fb-contrib*">
+ </jar>
+ <echo message="" />
+ <echo message="" />
+ <echo message="====================================================================================================================================" />
+ <echo message="sonatype update bundle produced at ${sonatype.dir}/bundle.jar" />
+ <echo message="upload this jar at https://oss.sonatype.org" />
+ <echo message="" />
+ <echo message="see link for details-> https://docs.sonatype.org/display/Repository/Uploading+3rd-party+Artifacts+to+The+Central+Repository" />
+ <echo message="====================================================================================================================================" />
+ </target>
</project>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/etc/messages.xml 2012-12-30 08:44:25 UTC (rev 1735)
@@ -3577,7 +3577,7 @@
<BugCode abbrev="SMA">Stuttered Method Arguments</BugCode>
<BugCode abbrev="TBP">Tristate Boolean Pattern</BugCode>
<BugCode abbrev="SUA">Suspicious Uninitialized Array</BugCode>
- <BugCode abbrev="ITU">Inappropriate ToString Use</BugCode>
+ <BugCode abbrev="ITU">Inappropriate toString Use</BugCode>
<BugCode abbrev="IKNC">Inconsistent Key Name Casing</BugCode>
<BugCode abbrev="OC">Overzealous Casting</BugCode>
<BugCode abbrev="PDP">Poorly Defined Parameter</BugCode>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/pom.xml 2012-12-30 08:44:25 UTC (rev 1735)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>4.7.0</version>
+ <version>4.9.0</version>
<parent>
<groupId>org.sonatype.oss</groupId>
@@ -91,7 +91,7 @@
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>findbugs</artifactId>
- <version>2.0.0</version>
+ <version>2.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
Modified: trunk/fb-contrib/samples/BAS_Sample.java
===================================================================
--- trunk/fb-contrib/samples/BAS_Sample.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/samples/BAS_Sample.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -1,5 +1,7 @@
import java.util.Calendar;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -151,4 +153,19 @@
System.out.println(delta);
}
}
+
+ public String testFPIteratorNext(Collection<String> c, boolean b) {
+ Iterator<String> it = c.iterator();
+
+ String s = it.next();
+
+ if (b) {
+ if (s == null) {
+ return "yay";
+ }
+ }
+
+ return it.next();
+
+ }
}
Modified: trunk/fb-contrib/samples/CCNE_Sample.java
===================================================================
--- trunk/fb-contrib/samples/CCNE_Sample.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/samples/CCNE_Sample.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -5,4 +5,11 @@
System.out.println(o.getClass().getName()
.equals(p.getClass().getName()));
}
+
+ public void fpCompareAgainstString(String name) {
+ Object o = new CCNE_Sample();
+
+ if (o.getClass().getName().equals(name))
+ System.out.println("booya");
+ }
}
Modified: trunk/fb-contrib/samples/MRC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/MRC_Sample.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/samples/MRC_Sample.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -1,3 +1,4 @@
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -3,19 +4,19 @@
@SuppressWarnings("all")
-public class MRC_Sample
+public class MRC_Sample
{
private int getValue() {
return 1;
}
-
+
private String getStringValue() {
return "Hello";
}
-
+
public float getFP()
{
return 0.0f;
}
-
+
private double getTwoValuesFP(boolean b)
{
@@ -25,23 +26,23 @@
else
return 0.0;
}
-
+
private String getTwoDupsBySwitch(int i)
{
switch (i)
{
case 1:
return "Hello";
-
+
case 2:
return "Hello";
-
+
default:
return "Hello";
}
}
-
-
+
+
private String fpStringBuilder()
{
StringBuilder sb = new StringBuilder();
@@ -49,12 +50,12 @@
return sb.toString();
}
-
+
private void fooIt(StringBuilder sb)
{
sb.append("Foo");
}
-
+
private int getCount(List<String> l)
{
int count = 0;
@@ -66,14 +67,24 @@
count += 1;
}
}
-
+
return count;
}
-
+
private int fpInc()
{
int i = 0;
i++;
return i;
}
+
+ private long fpCountChars(Collection<String> c)
+ {
+ long totLength = 0;
+ for (String s : c)
+ {
+ totLength += s.length();
+ }
+ return totLength;
+ }
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2012 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
@@ -41,7 +41,7 @@
private final BugReporter bugReporter;
private List<FinallyBlockInfo> fbInfo;
private int loadedReg;
-
+
/**
* constructs a AFBR detector given the reporter to report bugs on.
@@ -50,10 +50,10 @@
public AbnormalFinallyBlockReturn(final BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
-
+
/**
* overrides the visitor to check for java class version being as good or better than 1.4
- *
+ *
* @param classContext the context object that holds the JavaClass parsed
*/
@Override
@@ -69,26 +69,26 @@
super.visitClassContext(classContext);
}
} finally {
- fbInfo = null;
+ fbInfo = null;
}
}
-
+
/**
* overrides the visitor to collect finally block info.
- *
+ *
* @param obj the code object to scan for finally blocks
*/
@Override
public void visitCode(Code obj) {
fbInfo.clear();
loadedReg = -1;
-
+
CodeException[] exc = obj.getExceptionTable();
if (exc != null) {
for (CodeException ce : exc) {
if ((ce.getCatchType() == 0)
&& (ce.getStartPC() == ce.getHandlerPC())) {
- fbInfo.add(new FinallyBlockInfo(ce.getStartPC(), ce.getEndPC()));
+ fbInfo.add(new FinallyBlockInfo(ce.getStartPC()));
}
}
}
@@ -96,22 +96,22 @@
if (!fbInfo.isEmpty())
super.visitCode(obj);
}
-
+
/**
* overrides the visitor to find return/exceptions from the finally block.
- *
+ *
* @param seen the opcode that is being visited
*/
@Override
public void sawOpcode(int seen) {
if (fbInfo.isEmpty())
return;
-
+
FinallyBlockInfo fbi = fbInfo.get(0);
-
+
if (getPC() < fbi.startPC)
return;
-
+
if (getPC() == fbi.startPC) {
if (seen == ASTORE)
fbi.exReg = getRegisterOperand();
@@ -124,7 +124,7 @@
}
return;
}
-
+
if (seen == MONITORENTER) {
fbi.monitorCount++;
} else if (seen == MONITOREXIT) {
@@ -135,11 +135,11 @@
return;
}
}
-
+
if ((seen == ATHROW) && (loadedReg == fbi.exReg)) {
fbInfo.remove(0);
sawOpcode(seen);
- return;
+ return;
}
else if (seen == ALOAD)
loadedReg = getRegisterOperand();
@@ -147,7 +147,7 @@
loadedReg = seen - ALOAD_0;
else
loadedReg = -1;
-
+
if (((seen >= IRETURN) && (seen <= RETURN)) || (seen == ATHROW)) {
bugReporter.reportBug(new BugInstance( this, "AFBR_ABNORMAL_FINALLY_BLOCK_RETURN", NORMAL_PRIORITY)
.addClass(this)
@@ -175,14 +175,14 @@
}
}
}
-
+
/**
* finds the method in specified class by name and signature
- *
+ *
* @param cls the class to look the method in
* @param name the name of the method to look for
* @param sig the signature of the method to look for
- *
+ *
* @return the Method object for the specified information
*/
private Method findMethod(JavaClass cls, String name, String sig) {
@@ -192,26 +192,26 @@
return m;
}
}
-
+
return null;
}
-
+
/**
* looks to see if any try/catch block exists inside this finally block, that
- * wrap the current pc. This is a lax check as the try catch block may not
- * catch exceptions that are thrown, but doing so would be prohibitively slow.
+ * wrap the current pc. This is a lax check as the try catch block may not
+ * catch exceptions that are thrown, but doing so would be prohibitively slow.
* But it should catch some problems.
- *
+ *
* @param fBlockInfo the finally block the pc is currently in
- *
+ *
* @return if all exceptions are caught inside this finally block
*/
private boolean catchBlockInFinally(FinallyBlockInfo fBlockInfo) {
-
+
CodeException[] catchExceptions = getCode().getExceptionTable();
if ((catchExceptions == null) || (catchExceptions.length == 0))
return false;
-
+
int pc = getPC();
for (CodeException ex : catchExceptions) {
if ((ex.getStartPC() <= pc) && (ex.getEndPC() >= pc)) {
@@ -220,29 +220,26 @@
}
}
}
-
+
return false;
}
-
+
/**
* holds the finally block information for a particular method.
*/
public static class FinallyBlockInfo
{
public int startPC;
- public int endPC;
public int monitorCount;
public int exReg;
-
+
/**
* create a finally block info for a specific code range
- *
+ *
* @param start the start of the try block
- * @param end the end of the try block
*/
- public FinallyBlockInfo(int start, int end) {
+ public FinallyBlockInfo(int start) {
startPC = start;
- endPC = end;
monitorCount = 0;
exReg = -1;
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -53,8 +53,9 @@
static {
dangerousAssignmentClassSources.add("java/io/InputStream");
dangerousAssignmentClassSources.add("java/io/ObjectInput");
- dangerousAssignmentMethodSources
- .add("java/lang/System.currentTimeMillis()J");
+ dangerousAssignmentMethodSources.add("java/lang/System.currentTimeMillis()J");
+ dangerousAssignmentMethodSources.add("java/util/Iterator.next()Ljava/lang/Object;");
+ dangerousAssignmentMethodSources.add("java/util/regex/Matcher.start()I");
}
BugReporter bugReporter;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -2,17 +2,17 @@
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2012 Bhaskar Maddala
* Copyright (C) 2005-2012 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
@@ -30,7 +30,7 @@
/**
* Find usage of EqualsBuilder from Apache commons, where the code invoke
* equals() on the constructed object rather than isEquals()
- *
+ *
* <pre>
* new EqualsBuilder().append(this.name, other.name).equals(other);
* </pre>
@@ -42,7 +42,7 @@
/**
* constructs a CEBE detector given the reporter to report bugs on.
- *
+ *
* @param bugReporter
* the sync of bug reports
*/
@@ -56,7 +56,7 @@
* initializers to the byte code scanning code. These methods are not
* reported, but are used to build SourceLineAnnotations for fields, if
* accessed.
- *
+ *
* @param obj
* the context object of the currently parsed code attribute
*/
@@ -76,8 +76,8 @@
case INVOKEVIRTUAL:
String methodName = getNameConstantOperand();
if ("equals".equals(methodName)
- && "(Ljava/lang/Object;)Z"
- .equals(getSigConstantOperand())) {
+ && "(Ljava/lang/Object;)Z".equals(getSigConstantOperand())
+ && (stack.getStackDepth() > 1)) {
String calledClass = stack.getStackItem(1).getSignature();
if ("Lorg/apache/commons/lang3/builder/EqualsBuilder;"
.equals(calledClass)
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -2,17 +2,17 @@
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2012 Bhaskar Maddala
* Copyright (C) 2005-2012 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
@@ -30,7 +30,7 @@
/**
* Find usage of HashCodeBuilder from Apache commons, where the code invokes
* hashCode() on the constructed object rather than toHashCode()
- *
+ *
* <pre>
* new HashCodeBuilder().append(this.name).hashCode();
* </pre>
@@ -42,7 +42,7 @@
/**
* constructs a CHTH detector given the reporter to report bugs on.
- *
+ *
* @param bugReporter
* the sync of bug reports
*/
@@ -56,7 +56,7 @@
* initializers to the byte code scanning code. These methods are not
* reported, but are used to build SourceLineAnnotations for fields, if
* accessed.
- *
+ *
* @param obj
* the context object of the currently parsed code attribute
*/
@@ -76,7 +76,8 @@
case INVOKEVIRTUAL:
String methodName = getNameConstantOperand();
if ("hashCode".equals(methodName)
- && "()I".equals(getSigConstantOperand())) {
+ && "()I".equals(getSigConstantOperand())
+ && (stack.getStackDepth() > 0)) {
String calledClass = stack.getStackItem(0).getSignature();
if ("Lorg/apache/commons/lang3/builder/HashCodeBuilder;"
.equals(calledClass)
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -2,17 +2,17 @@
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2012 Bhaskar Maddala
* Copyright (C) 2005-2012 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
@@ -37,10 +37,10 @@
/**
* Find usage of ToStringBuilder from Apache commons, where the code invokes
* toString() on the constructed object without invoking append().
- *
+ *
* Usage without invoking append is equivalent of using the Object.toString()
* method
- *
+ *
* <pre>
* new ToStringBuilder(this).toString();
* </pre>
@@ -53,7 +53,7 @@
/**
* constructs a CSBTS detector given the reporter to report bugs on.
- *
+ *
* @param bugReporter
* the sync of bug reports
*/
@@ -126,12 +126,12 @@
case INVOKEVIRTUAL:
String loadClassName = getClassConstantOperand();
String calledMethodName = getNameConstantOperand();
- String calledMethodSig = getSigConstantOperand();
if ("org/apache/commons/lang3/builder/ToStringBuilder"
.equals(loadClassName)
|| "org/apache/commons/lang/builder/ToStringBuilder"
.equals(loadClassName)) {
+ String calledMethodSig = getSigConstantOperand();
if ("<init>".equals(calledMethodName)
&& "(Ljava/lang/Object;)V".equals(calledMethodSig)) {
stackTracker.add(new Pair(-1, false));
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -75,8 +75,10 @@
&& "(Ljava/lang/Object;)Z".equals(getSigConstantOperand())
&& "java/lang/String".equals(getClassConstantOperand())) {
Item item = stack.getItemMethodInvokedOn(this);
- Object userValue = item.getUserValue();
- if (userValue != null && Boolean.TRUE.equals(userValue)) {
+ Object srcValue = item.getUserValue();
+ item = stack.getStackItem(0);
+ Object dstValue = item.getUserValue();
+ if (Boolean.TRUE.equals(srcValue) && Boolean.TRUE.equals(dstValue)) {
bugReporter
.reportBug(new BugInstance(this,
"CCNE_COMPARE_CLASS_EQUALS_NAME",
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -90,10 +90,10 @@
case ASTORE_3:
if(stack.getStackDepth() > 0){
OpcodeStack.Item item = stack.getStackItem(0);
- String sourceSignature = item.getSignature();
LocalVariable lv = getMethod().getLocalVariableTable()
.getLocalVariable(RegisterUtils.getAStoreReg(this, seen), getNextPC());
if(lv != null){
+ String sourceSignature = item.getSignature();
String targetSignature = lv.getSignature();
checkSignatures(sourceSignature, targetSignature);
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2012-12-30 07:51:38 UTC (rev 1734)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2012-12-30 08:44:25 UTC (rev 1735)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2012 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
@@ -34,7 +34,7 @@
/**
* looks for methods that build xml based strings by concatenation strings
- * and custom values together. Doing so makes brittle code, that is difficult to
+ * 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.
*/
@@ -51,7 +51,7 @@
xmlPatterns.put(Pattern.compile("^[\"']>.*"), Boolean.TRUE);
xmlPatterns.put(Pattern.compile(".*<!\\[CDATA\\[.*", Pattern.CASE_INSENSITIVE), Boolean.TRUE);
xmlPatterns.put(Pattern.compile(".*\\]\\]>.*"), Boolean.TRUE);
- xmlPatterns.put(Pattern.compile(".*xmlns:.*"), Boolean.TRUE);
+ xmlPatterns.put(Pattern.compile(".*xmlns:.*"), Boolean.TRUE);
}
private static final String CBX_MIN_REPORTABLE_ITEMS = "fb-contrib.cbx.minxmlitems";
private BugReporter bugReporter;
@@ -62,7 +62,7 @@
private int midReportingThreshold;
private int highReportingThreshold;
private int firstPC;
-
+
/**
* constructs a CBX detector given the reporter to report bugs on
@@ -70,15 +70,15 @@
*/
public CustomBuiltXML(BugReporter bugReporter) {
this.bugReporter = bugReporter;
-
+
lowReportingThreshold = Integer.getInteger(CBX_MIN_REPORTABLE_ITEMS, 5).intValue();
midReportingThreshold = lowReportingThreshold << 1;
highReportingThreshold = lowReportingThreshold << 2;
}
-
+
/**
* overrides the visitor to create and destroy the stack
- *
+ *
* @param classContext the context object of the currently parsed class
*/
@Override
@@ -90,12 +90,12 @@
stack = null;
}
}
-
+
/**
* overrides the visitor reset the opcode stack
- *
+ *
* @param obj the code object of the currently parsed method
- */
+ */
@Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
@@ -103,7 +103,7 @@
xmlConfidentCount = 0;
firstPC = -1;
super.visitCode(obj);
- if ((xmlItemCount >= lowReportingThreshold)
+ if ((xmlItemCount >= lowReportingThreshold)
&& (xmlConfidentCount > (lowReportingThreshold >> 1))) {
bugReporter.reportBug( new BugInstance( this,
"CBX_CUSTOM_BUILT_XML",
@@ -113,22 +113,22 @@
.addClass(this)
.addMethod(this)
.addSourceLine(this, firstPC));
-
+
}
}
-
+
/**
* overrides the visitor to find String concatenations including xml strings
- *
+ *
* @param seen the opcode that is being visited
- */
+ */
@Override
public void sawOp...
[truncated message content] |
|
From: <dbr...@us...> - 2013-01-30 06:53:37
|
Revision: 1738
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1738&view=rev
Author: dbrosius
Date: 2013-01-30 06:53:29 +0000 (Wed, 30 Jan 2013)
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/samples/LO_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/build.xml 2013-01-30 06:53:29 UTC (rev 1738)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.9.0" />
+ <property name="fb-contrib.version" value="4.8.2" />
<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 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-01-30 06:53:29 UTC (rev 1738)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/htdocs/index.shtml 2013-01-30 06:53:29 UTC (rev 1738)
@@ -68,8 +68,8 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.1 available for download
- <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.1.jar/download">here</a>.</p>
+ <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.2 available for download
+ <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.2.jar/download">here</a>.</p>
</div>
<hr/>
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/htdocs/repository.html 2013-01-30 06:53:29 UTC (rev 1738)
@@ -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</td></tr>
<tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr>
- <tr><td><b>Version:</b></td><td>4.8.1</td></tr>
+ <tr><td><b>Version:</b></td><td>4.8.2</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/pom.xml 2013-01-30 06:53:29 UTC (rev 1738)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>4.9.0</version>
+ <version>4.8.2</version>
<parent>
<groupId>org.sonatype.oss</groupId>
Modified: trunk/fb-contrib/samples/LO_Sample.java
===================================================================
--- trunk/fb-contrib/samples/LO_Sample.java 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/samples/LO_Sample.java 2013-01-30 06:53:29 UTC (rev 1738)
@@ -1,3 +1,5 @@
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -4,19 +6,20 @@
import java.io.InputStream;
import org.apache.log4j.Logger;
+import org.apache.log4j.spi.LoggerFactory;
@SuppressWarnings("all")
-public class LO_Sample
+public class LO_Sample
{
private static Logger l1 = Logger.getLogger(String.class);
private static Logger l2 = Logger.getLogger("com.foo.LO_Sample");
-
+
public LO_Sample(Logger l3)
{
-
+
}
-
+
public void testStutter() throws IOException
{
InputStream is = null;
@@ -34,4 +37,18 @@
is.close();
}
}
+
+ public class Inner
+ {
+ public void fpUseAnon() {
+ ActionListener l = new ActionListener()
+ {
+ public void actionPerformed(ActionEvent ae)
+ {
+ Logger.getLogger(Inner.class).error("fp");
+ Logger.getLogger(LO_Sample.class).error("not fp");
+ }
+ };
+ }
+ }
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2013-01-29 08:07:07 UTC (rev 1737)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2013-01-30 06:53:29 UTC (rev 1738)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2013 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
@@ -42,11 +42,11 @@
public class LoggerOddities extends BytecodeScanningDetector {
private static JavaClass THROWABLE_CLASS;
private static Set<String> loggerMethods;
-
+
static {
try {
THROWABLE_CLASS = Repository.lookupClass("java/lang/Throwable");
-
+
loggerMethods = new HashSet<String>();
loggerMethods.add("trace");
loggerMethods.add("debug");
@@ -61,7 +61,7 @@
private final BugReporter bugReporter;
private OpcodeStack stack;
private String clsName;
-
+
/**
* constructs a LO detector given the reporter to report bugs on.
@@ -70,12 +70,12 @@
public LoggerOddities(final BugReporter bugReporter) {
this.bugReporter = bugReporter;
}
-
-
+
+
/**
* implements the visitor to discover what the class name is if it is a normal class,
* or the owning class, if the class is an anonymous class.
- *
+ *
* @param classContext the context object of the currently parsed class
*/
@Override
@@ -100,10 +100,10 @@
stack = null;
}
}
-
+
/**
* implements the visitor to reset the stack
- *
+ *
* @param obj the context object of the currently parsed code block
*/
@Override
@@ -127,17 +127,17 @@
}
super.visitCode(obj);
}
-
+
/**
* implements the visitor to look for calls to Logger.getLogger with the wrong class name
- *
+ *
* @param seen the opcode of the currently parsed instruction
*/
@Override
public void sawOpcode(int seen) {
String ldcClassName = null;
int exMessageReg = -1;
-
+
try {
if ((seen == LDC) || (seen == LDC_W)) {
Constant c = getConstantRefOperand();
@@ -148,13 +148,13 @@
} else if (seen == INVOKESTATIC) {
String callingClsName = getClassConstantOperand();
String mthName = getNameConstantOperand();
-
+
String loggingClassName = null;
if ("org/slf4j/LoggerFactory".equals(callingClsName)
&& "getLogger".equals(mthName)) {
String signature = getSigConstantOperand();
-
+
if ("(Ljava/lang/Class;)Lorg/slf4j/Logger;".equals(signature)) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
@@ -168,11 +168,11 @@
loggingClassName = loggingClassName.replace('.', '/');
}
}
- }
+ }
} else if ("org/apache/log4j/Logger".equals(callingClsName)
&& "getLogger".equals(mthName)) {
String signature = getSigConstantOperand();
-
+
if ("(Ljava/lang/Class;)Lorg/apache/log4j/Logger;".equals(signature)) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
@@ -198,7 +198,7 @@
} else if ("org/apache/commons/logging/LogFactory".equals(callingClsName)
&& "getLog".equals(mthName)) {
String signature = getSigConstantOperand();
-
+
if ("(Ljava/lang/Class;)Lorg/apache/commons/logging/Log;".equals(signature)) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
@@ -212,16 +212,27 @@
loggingClassName = loggingClassName.replace('.', '/');
}
}
- }
+ }
}
if (loggingClassName != null) {
if (stack.getStackDepth() > 0) {
if (!loggingClassName.equals(clsName)) {
- bugReporter.reportBug(new BugInstance(this, "LO_SUSPECT_LOG_CLASS", (callingClsName.indexOf('$') >= 0) ? LOW_PRIORITY : NORMAL_PRIORITY)
- .addClass(this)
- .addMethod(this)
- .addSourceLine(this));
+ boolean isPrefix = clsName.startsWith(loggingClassName);
+ boolean isAnonClassPrefix;
+ if (isPrefix) {
+ String anonClass = clsName.substring(loggingClassName.length());
+ isAnonClassPrefix = anonClass.matches("(\\$\\d+)+");
+ } else {
+ isAnonClassPrefix = false;
+ }
+
+ if (!isAnonClassPrefix) {
+ bugReporter.reportBug(new BugInstance(this, "LO_SUSPECT_LOG_CLASS", NORMAL_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
}
}
}
@@ -244,7 +255,7 @@
if (stack.getStackDepth() >= 2) {
OpcodeStack.Item exItem = stack.getStackItem(0);
OpcodeStack.Item msgItem = stack.getStackItem(1);
-
+
Integer exReg = (Integer)msgItem.getUserValue();
if (exReg != null) {
if (exReg.intValue() == exItem.getRegisterNumber()) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2013-02-06 05:02:36
|
Revision: 1740
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1740&view=rev
Author: dbrosius
Date: 2013-02-06 05:02:24 +0000 (Wed, 06 Feb 2013)
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/htdocs/repository.html
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples/STB_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/build.xml 2013-02-06 05:02:24 UTC (rev 1740)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.8.2" />
+ <property name="fb-contrib.version" value="4.9.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 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-02-06 05:02:24 UTC (rev 1740)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
@@ -236,6 +236,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_THROWS" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" />
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -410,4 +412,5 @@
<BugPattern abbrev="BRPI" type="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" category ="PERFORMANCE" />
<BugPattern abbrev="CU" type="CU_CLONE_USABILITY_OBJECT_RETURN" category="STYLE" />
<BugPattern abbrev="CU" type="CU_CLONE_USABILITY_THROWS" category="STYLE" />
+ <BugPattern abbrev="CAAL" type="CAAL_CONFUSING_ARRAY_AS_LIST" category="CORRECTNESS" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/etc/messages.xml 2013-02-06 05:02:24 UTC (rev 1740)
@@ -1281,6 +1281,17 @@
]]>
</Details>
</Detector>
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList">
+ <Details>
+ <![CDATA[
+ <p> Looks for calls to Arrays.asList where the parameter is a primitive array.
+ This does not produce a list that holds the primitive boxed values, but a list of
+ one item, the array itself.
+ </p>
+ ]]>
+ </Details>
+ </Detector>
<!-- BugPattern -->
@@ -3493,7 +3504,21 @@
]]>
</Details>
</BugPattern>
-
+
+ <BugPattern type="CAAL_CONFUSING_ARRAY_AS_LIST">
+ <ShortDescription>Method calls Array.asList on an array of primitive values</ShortDescription>
+ <LongDescription>Method {1} calls Array.asList on an array of primitive values</LongDescription>
+ <Details>
+ <![CDATA[
+ <p> This method passes an array of primitive values to the Array.asList call. As primitive
+ values in arrays aren't automatically promoted to boxed primitives in arrays, the asList call
+ cannot convert this array in a list of boxed primitives. It therefore just creates an array
+ with one item in it, the array itself. This is rarely what is desired.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<!-- BugCode -->
<BugCode abbrev="ISB">Inefficient String Buffering</BugCode>
@@ -3602,4 +3627,5 @@
<BugCode abbrev="CCNE">Compare class name equals</BugCode>
<BugCode abbrev="BRPI">Backport concurrent reuse of public identifiers</BugCode>
<BugCode abbrev="CU">Clone Usability</BugCode>
+ <BugCode abbrev="CAAL">Confusing Array asList</BugCode>
</MessageCollection>
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/htdocs/repository.html 2013-02-06 05:02:24 UTC (rev 1740)
@@ -18,14 +18,16 @@
<p><a href="http://master.dl.sourceforge.net/project/fb-contrib/repo">http://master.dl.sourceforge.net/project/fb-contrib/repo</a></p>
-<div style="width: 200px">
+<div style="width: 400px">
<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</td></tr>
+ <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>4.8.2</td></tr>
</table>
</div>
+<p>fb-contrib is also now available at <a href="http://search.maven.org">search.maven.org</a></p>
+
</div>
</body>
</html>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/pom.xml 2013-02-06 05:02:24 UTC (rev 1740)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>4.8.2</version>
+ <version>4.9.0</version>
<parent>
<groupId>org.sonatype.oss</groupId>
Modified: trunk/fb-contrib/samples/STB_Sample.java
===================================================================
--- trunk/fb-contrib/samples/STB_Sample.java 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/samples/STB_Sample.java 2013-02-06 05:02:24 UTC (rev 1740)
@@ -18,6 +18,38 @@
}
}
+ public void testSTB2(File f1, File f2) throws STBException {
+ try {
+ InputStream is = new FileInputStream(f1);
+ } catch (IOException ioe) {
+ throw new STBException("It's broken");
+ }
+
+ try {
+ InputStream is = new FileInputStream(f2);
+ } catch (IOException ioe) {
+ throw new STBException("It's broken");
+ }
+ }
+
+ public void testSTB3(File f1, File f2) throws STBException {
+ try {
+ InputStream is = new FileInputStream(f1);
+ } catch (IOException ioe) {
+ STBException se = new STBException("It's broken");
+ se.initCause(ioe);
+ throw se;
+ }
+
+ try {
+ InputStream is = new FileInputStream(f2);
+ } catch (IOException ioe) {
+ STBException se = new STBException("It's broken");
+ se.initCause(ioe);
+ throw se;
+ }
+ }
+
public void fpTestMethodDeclaresThrownType(File f1, File f2) throws STBException, IOException {
try {
InputStream is = new FileInputStream(f1);
@@ -31,7 +63,7 @@
throw new STBException();
}
}
-
+
public void fpTestDiffMessages(File f1, File f2) throws STBException {
try {
InputStream is = new FileInputStream(f1);
@@ -45,7 +77,7 @@
throw new STBException("Couldn't open file 2");
}
}
-
+
public void fpTestDiffMessagesByAppending(File f1, File f2) throws STBException {
try {
InputStream is = new FileInputStream(f1);
@@ -61,10 +93,10 @@
}
static class STBException extends Exception {
-
+
public STBException() {
}
-
+
public STBException(String message) {
super(message);
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2013-02-06 05:02:24 UTC (rev 1740)
@@ -88,11 +88,11 @@
case ASTORE_1:
case ASTORE_2:
case ASTORE_3:
- if(stack.getStackDepth() > 0){
- OpcodeStack.Item item = stack.getStackItem(0);
+ if(stack.getStackDepth() > 0) {
LocalVariable lv = getMethod().getLocalVariableTable()
.getLocalVariable(RegisterUtils.getAStoreReg(this, seen), getNextPC());
- if(lv != null){
+ if(lv != null) {
+ OpcodeStack.Item item = stack.getStackItem(0);
String sourceSignature = item.getSignature();
String targetSignature = lv.getSignature();
checkSignatures(sourceSignature, targetSignature);
@@ -101,7 +101,7 @@
break;
case PUTFIELD:
case PUTSTATIC:
- if(stack.getStackDepth() > 0){
+ if(stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
String sourceSignature = item.getSignature();
String targetSignature = getSigConstantOperand();
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2013-02-06 05:02:24 UTC (rev 1740)
@@ -19,7 +19,9 @@
package com.mebigfatguy.fbcontrib.detect;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
import org.apache.bcel.classfile.Code;
import org.apache.bcel.generic.Type;
@@ -35,6 +37,13 @@
public class PossibleConstantAllocationInLoop extends BytecodeScanningDetector {
+ private static final Set<String> SYNTHETIC_ALLOCATION_CLASSES = new HashSet<String>();
+ static {
+ SYNTHETIC_ALLOCATION_CLASSES.add("java/lang/StringBuffer");
+ SYNTHETIC_ALLOCATION_CLASSES.add("java/lang/StringBuilder");
+ SYNTHETIC_ALLOCATION_CLASSES.add("java/lang/AssertionError");
+ }
+
private final BugReporter bugReporter;
private OpcodeStack stack;
/** allocation number, info where allocated */
@@ -119,7 +128,7 @@
case INVOKESPECIAL:
if ("<init>".equals(getNameConstantOperand()) && "()V".equals(getSigConstantOperand())) {
String clsName = getClassConstantOperand();
- if (!"java/lang/StringBuffer".equals(clsName) && !"java/lang/StringBuilder".equals(clsName)) {
+ if (!SYNTHETIC_ALLOCATION_CLASSES.contains(clsName)) {
sawAllocationNumber = Integer.valueOf(nextAllocationNumber);
allocations.put(sawAllocationNumber, new AllocationInfo(getPC()));
sawAllocation = true;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2013-02-06 05:02:24 UTC (rev 1740)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2013 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
@@ -51,7 +51,7 @@
private static final String SAW_TEXT_LABEL = "SAW_TEXT_LABEL";
private static final String FROM_UIMANAGER = "FROM_UIMANAGER";
private static final String APPENDED_STRING = "APPENDED_STRING";
-
+
private static JavaClass windowClass;
private static JavaClass componentClass;
private static JavaClass jcomponentClass;
@@ -83,16 +83,16 @@
clsNFException = cnfe;
}
}
-
+
private static final Map<String, Integer> displayTextMethods = new HashMap<String, Integer>();
static {
- displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;)", Integer.valueOf(0));
+ displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;)", Integer.valueOf(0));
displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;Ljavax/swing/Icon;I)", Integer.valueOf(1));
displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;I)", Integer.valueOf(2));
- displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;)", Integer.valueOf(0));
- displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;Ljavax/swing/Icon;)", Integer.valueOf(1));
- displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;)", Integer.valueOf(0));
- displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;Ljava/awt/GraphicsConfiguration;)", Integer.valueOf(1));
+ displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;)", Integer.valueOf(0));
+ displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;Ljavax/swing/Icon;)", Integer.valueOf(1));
+ displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;)", Integer.valueOf(0));
+ displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;Ljava/awt/GraphicsConfiguration;)", Integer.valueOf(1));
displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Dialog;Ljava/lang/String;)", Integer.valueOf(0));
displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Dialog;Ljava/lang/String;Z)", Integer.valueOf(1));
displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Dialog;Ljava/lang/String;ZLjava/awt/GraphicsConfiguration;)", Integer.valueOf(2));
@@ -102,12 +102,12 @@
displayTextMethods.put("java/awt/Dialog#setTitle(Ljava/lang/String;)", Integer.valueOf(0));
displayTextMethods.put("java/awt/Frame#setTitle(Ljava/lang/String;)", Integer.valueOf(0));
displayTextMethods.put("javax/swing/JMenu#<init>(Ljava/lang/String;)", Integer.valueOf(0));
- displayTextMethods.put("javax/swing/JMenu#<init>(Ljava/lang/String;Z)", Integer.valueOf(1));
- displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;)", Integer.valueOf(0));
+ displayTextMethods.put("javax/swing/JMenu#<init>(Ljava/lang/String;Z)", Integer.valueOf(1));
+ displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;)", Integer.valueOf(0));
displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;Ljavax/swing/Icon;)", Integer.valueOf(1));
displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;I)", Integer.valueOf(1));
}
-
+
private final BugReporter bugReporter;
private OpcodeStack stack;
private Set<XField> fieldLabels;
@@ -125,7 +125,7 @@
/**
* implements the visitor to create and clear the stack
- *
+ *
* @param classContext the context object of the currently visited class
*/
@Override
@@ -161,7 +161,7 @@
/**
* looks for fields that are JLabels and stores them in a set
- *
+ *
* @param obj the field object of the current field
*/
@Override
@@ -176,7 +176,7 @@
/**
* implements the visitor to reset the stack
- *
+ *
* @param obj the context object for the currently visited code block
*/
@Override
@@ -199,7 +199,7 @@
/**
* implements the visitor to find 508 compliance concerns
- *
+ *
* @param seen the opcode of the currently parsed instruction
*/
@Override
@@ -239,7 +239,7 @@
} else if (seen == INVOKEVIRTUAL) {
String className = getClassConstantOperand();
String methodName = getNameConstantOperand();
-
+
if ("javax/swing/JLabel".equals(className)) {
if ("setLabelFor".equals(methodName)) {
if (stack.getStackDepth() > 1) {
@@ -276,7 +276,7 @@
}
}
}
-
+
processSetSizeOps(methodName);
processNullLayouts(className, methodName);
processSetColorOps(methodName);
@@ -285,7 +285,7 @@
sawUIManager = true;
}
}
-
+
if ((seen == INVOKEVIRTUAL) || (seen == INVOKESPECIAL) || (seen == INVOKEINTERFACE)) {
processFaultyGuiStrings();
}
@@ -304,7 +304,7 @@
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(FROM_UIMANAGER);
- }
+ }
} else if (sawAppend) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
@@ -313,7 +313,7 @@
}
}
}
-
+
/**
* looks for calls to set a readable string that is generated from a static constant, as these strings
* are not translatable. also looks for setting readable strings that are appended together. This is
@@ -329,7 +329,7 @@
methodInfo.append(signature);
Integer parmIndex = displayTextMethods.get(methodInfo.toString());
if (parmIndex != null) {
- if (stack.getStackDepth() >= parmIndex.intValue()) {
+ if (stack.getStackDepth() > parmIndex.intValue()) {
OpcodeStack.Item item = stack.getStackItem(parmIndex.intValue());
if (item.getConstant() != null) {
bugReporter.reportBug(new BugInstance(this, "S508C_NON_TRANSLATABLE_STRING", NORMAL_PRIORITY)
@@ -341,15 +341,15 @@
.addClass(this)
.addMethod(this)
.addSourceLine(this));
-
+
}
}
}
}
-
+
/**
* looks for containers where a null layout is installed
- *
+ *
* @param className class that a method call is made on
* @param methodName name of the method that is called
*/
@@ -368,12 +368,12 @@
}
}
}
-
+
/**
* looks for calls to set the color of components where the color isn't from UIManager
- *
+ *
* @param methodName the method that is called
- *
+ *
* @throws ClassNotFoundException if the gui component class can't be found
*/
private void processSetColorOps(String methodName) throws ClassNotFoundException {
@@ -396,12 +396,12 @@
}
}
}
-
+
/**
* looks for calls to setSize on components, rather than letting the layout manager set them
- *
+ *
* @param methodName the method that was called on a component
- *
+ *
* @throws ClassNotFoundException if the gui class wasn't found
*/
private void processSetSizeOps(String methodName) throws ClassNotFoundException {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2013-01-30 06:57:26 UTC (rev 1739)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2013-02-06 05:02:24 UTC (rev 1740)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -33,7 +34,7 @@
public class StackedTryBlocks extends BytecodeScanningDetector {
private static JavaClass THROWABLE_CLASS;
-
+
static {
try {
THROWABLE_CLASS = Repository.lookupClass("java.lang.Throwable");
@@ -44,6 +45,7 @@
private final BugReporter bugReporter;
private List<TryBlock> blocks;
private List<TryBlock> inBlocks;
+ private List<Integer> transitionPoints;
private OpcodeStack stack;
public StackedTryBlocks(BugReporter bugReporter) {
@@ -72,6 +74,7 @@
blocks = new ArrayList<TryBlock>();
inBlocks = new ArrayList<TryBlock>();
+ transitionPoints = new ArrayList<Integer>();
CodeException[] ces = obj.getExceptionTable();
for (CodeException ce : ces) {
@@ -99,19 +102,23 @@
super.visitCode(obj);
if (blocks.size() > 1) {
- TryBlock firstBlock = blocks.get(0);
+ Collections.sort(transitionPoints);
+
+ TryBlock firstBlock = blocks.get(0);
for (int i = 1; i < blocks.size(); i++) {
TryBlock secondBlock = blocks.get(i);
- if ((firstBlock.getCatchType() == secondBlock.getCatchType())
- && (firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature())
- && ((firstBlock.getMessage().length() > 0) && firstBlock.getMessage().equals(secondBlock.getMessage())
- && (firstBlock.getExceptionSignature().equals(secondBlock.getExceptionSignature()))))) {
- bugReporter.reportBug(new BugInstance(this, "STB_STACKED_TRY_BLOCKS", NORMAL_PRIORITY)
- .addClass(this).addMethod(this)
- .addSourceLineRange(this, firstBlock.getStartPC(), firstBlock.getEndHandlerPC())
- .addSourceLineRange(this, secondBlock.getStartPC(), secondBlock.getEndHandlerPC()));
+ if (!blocksSplitAcrossTransitions(firstBlock, secondBlock)) {
+ if ((firstBlock.getCatchType() == secondBlock.getCatchType())
+ && (firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature())
+ && (firstBlock.getMessage().equals(secondBlock.getMessage())
+ && (firstBlock.getExceptionSignature().equals(secondBlock.getExceptionSignature()))))) {
+ bugReporter.reportBug(new BugInstance(this, "STB_STACKED_TRY_BLOCKS", NORMAL_PRIORITY)
+ .addClass(this).addMethod(this)
+ .addSourceLineRange(this, firstBlock.getStartPC(), firstBlock.getEndHandlerPC())
+ .addSourceLineRange(this, secondBlock.getStartPC(), secondBlock.getEndHandlerPC()));
+ }
}
firstBlock = secondBlock;
@@ -121,6 +128,7 @@
} finally {
blocks = null;
inBlocks = null;
+ transitionPoints = null;
}
}
@@ -129,6 +137,12 @@
String message = null;
try {
+ if ((seen == TABLESWITCH) || (seen == LOOKUPSWITCH)) {
+ for (int offset : getSwitchOffsets()) {
+ transitionPoints.add(Integer.valueOf(offset));
+ }
+ }
+
int pc = getPC();
TryBlock block = findBlockWithStart(pc);
if (block != null) {
@@ -178,16 +192,19 @@
if (exCls.instanceOf(THROWABLE_CLASS)) {
String signature = getSigConstantOperand();
Type[] types = Type.getArgumentTypes(signature);
- if ((types.length > 0) && "Ljava/lang/String;".equals(types[0].getSignature())) {
- if (stack.getStackDepth() >= types.length) {
- OpcodeStack.Item item = stack.getStackItem(types.length - 1);
- message = (String)item.getConstant();
- if (message == null) {
- message = "____UNKNOWN____" + System.currentTimeMillis();
- }
+ if (types.length > 0) {
+ if ("Ljava/lang/String;".equals(types[0].getSignature())) {
+ if (stack.getStackDepth() >= types.length) {
+ OpcodeStack.Item item = stack.getStackItem(types.length - 1);
+ message = (String)item.getConstant();
+ if (message == null) {
+ message = "____UNKNOWN____" + System.identityHashCode(item);
+ }
+ }
}
+ } else {
+ message = "";
}
-
}
}
}
@@ -214,6 +231,22 @@
return null;
}
+ private boolean blocksSplitAcrossTransitions(TryBlock firstBlock, TryBlock secondBlock) {
+ if (!transitionPoints.isEmpty()) {
+ Iterator<Integer> it = transitionPoints.iterator();
+ while (it.hasNext()) {
+ Integer transitionPoint = it.next();
+ if (transitionPoint.intValue() < firstBlock.handlerPC) {
+ it.remove();
+ } else {
+ return transitionPoint.intValue() < secondBlock.handlerPC;
+ }
+ }
+ }
+
+ return false;
+ }
+
static class TryBlock {
public enum State {
@@ -277,11 +310,11 @@
public void setExceptionSignature(String sig) {
exSig = sig;
}
-
+
public void setThrowSignature(String sig) {
throwSig = sig;
}
-
+
public void setMessage(String m) {
message = m;
}
@@ -289,13 +322,13 @@
public String getExceptionSignature() {
return (exSig == null) ? String.valueOf(System.identityHashCode(this)) : exSig;
}
-
+
public String getThrowSignature() {
return (throwSig == null) ? String.valueOf(System.identityHashCode(this)) : throwSig;
}
-
+
public String getMessage() {
- return (message == null) ? String.valueOf(System.identityHashCode(this)) : message;
+ return (message == null) ? String.valueOf(System.identityHashCode(this)) : message;
}
public int getStartPC() {
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatgu...
[truncated message content] |
|
From: <dbr...@us...> - 2013-02-10 02:29:21
|
Revision: 1741
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1741&view=rev
Author: dbrosius
Date: 2013-02-10 02:29:13 +0000 (Sun, 10 Feb 2013)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/samples/MRC_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
Modified: trunk/fb-contrib/samples/MRC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/MRC_Sample.java 2013-02-06 05:02:24 UTC (rev 1740)
+++ trunk/fb-contrib/samples/MRC_Sample.java 2013-02-10 02:29:13 UTC (rev 1741)
@@ -1,3 +1,4 @@
+import java.awt.Component;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -6,6 +7,8 @@
@SuppressWarnings("all")
public class MRC_Sample
{
+ private Component[] components;
+
private int getValue() {
return 1;
}
@@ -87,4 +90,25 @@
}
return totLength;
}
+
+ private int getFPLoopVar(List<String> c) {
+ for (int i = 0; i < c.size(); i++) {
+ if (c.get(i) == null) {
+ return i;
+ }
+ }
+
+ throw new RuntimeException();
+ }
+
+ private int fpFindComponent(Component component) {
+ int index = 0;
+ while (this.components[index] != component) {
+ index++;
+ if (index >= this.components.length) {
+ return 0;
+ }
+ }
+ return index;
+ }
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2013-02-06 05:02:24 UTC (rev 1740)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2013-02-10 02:29:13 UTC (rev 1741)
@@ -18,6 +18,9 @@
*/
package com.mebigfatguy.fbcontrib.detect;
+import java.util.HashMap;
+import java.util.Map;
+
import org.apache.bcel.Constants;
import org.apache.bcel.classfile.Code;
import org.apache.bcel.classfile.Method;
@@ -38,6 +41,8 @@
{
private final BugReporter bugReporter;
private OpcodeStack stack;
+ private int returnRegister;
+ private Map<Integer, Object> registerConstants;
private Object returnConstant;
private boolean methodSuspect;
private int returnPC;
@@ -54,9 +59,11 @@
public void visitClassContext(ClassContext classContext) {
try {
stack = new OpcodeStack();
+ registerConstants = new HashMap<Integer, Object>();
super.visitClassContext(classContext);
} finally {
stack = null;
+ registerConstants = null;
}
}
@@ -73,7 +80,9 @@
&& ((aFlags & Constants.ACC_SYNTHETIC) == 0)
&& (!m.getSignature().endsWith(")Z"))) {
stack.resetForMethodEntry(this);
+ returnRegister = -1;
returnConstant = null;
+ registerConstants.clear();
methodSuspect = true;
returnPC = -1;
super.visitCode(obj);
@@ -108,12 +117,18 @@
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
+ int register = item.getRegisterNumber();
+ if (registerConstants.containsKey(register) && (registerConstants.get(register) == null)) {
+ methodSuspect = false;
+ return;
+ }
+
Object constant = item.getConstant();
if (constant == null) {
methodSuspect = false;
return;
}
- if ((item.getUserValue() != null) && ("".equals(constant))) {
+ if (Boolean.TRUE.equals(item.getUserValue()) && ("".equals(constant))) {
methodSuspect = false;
return;
}
@@ -122,6 +137,7 @@
return;
}
+ returnRegister = item.getRegisterNumber();
returnConstant = constant;
}
} else if ((seen == GOTO) || (seen == GOTO_W)) {
@@ -133,7 +149,35 @@
if (clsName.startsWith("java/lang/StringB")) {
sawSBToString = "toString".equals(getNameConstantOperand());
}
+ } else if ((seen >= ISTORE) && (seen <= ASTORE_3) || (seen == IINC)) {
+ int register = getRegisterOperand();
+ if ((returnRegister != -1) && (register == returnRegister)) {
+ methodSuspect = false;
+ }
+
+ if (stack.getStackDepth() > 0) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ Object constant = item.getConstant();
+ if (registerConstants.containsKey(register)) {
+ if ((constant == null) || !constant.equals(registerConstants.get(register))) {
+ registerConstants.put(register, null);
+ }
+ } else {
+ registerConstants.put(register, constant);
+ }
+ } else {
+ registerConstants.put(register, null);
+ }
+
+ if (returnRegister == register) {
+ Object constant = registerConstants.get(returnRegister);
+ if (constant != null) {
+ methodSuspect = false;
+ }
+ }
}
+
+
} finally {
TernaryPatcher.pre(stack, seen);
stack.sawOpcode(this, seen);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2013-03-04 04:48:05
|
Revision: 1742
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1742&view=rev
Author: dbrosius
Date: 2013-03-04 04:47:55 +0000 (Mon, 04 Mar 2013)
Log Message:
-----------
sync from github
Modified Paths:
--------------
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/samples/SPP_Sample.java
trunk/fb-contrib/samples/WOC_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
Added Paths:
-----------
trunk/fb-contrib/samples/CAAL_Sample.java
trunk/fb-contrib/samples/CU_Sample.java
trunk/fb-contrib/samples/PSC_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2013-02-10 02:29:13 UTC (rev 1741)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-03-04 04:47:55 UTC (rev 1742)
@@ -132,7 +132,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast"
- reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM" />
+ reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
@@ -165,7 +165,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_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER,LO_STUTTERED_MESSAGE" />
+ <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" />
<Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" />
@@ -237,6 +237,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_THROWS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
<!-- BugPattern -->
@@ -334,7 +336,8 @@
<BugPattern abbrev="SPP" type="SPP_SERIALVER_SHOULD_BE_PRIVATE" category="STYLE" />
<BugPattern abbrev="SPP" type="SPP_NON_ARRAY_PARM" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_EMPTY_CASING" category="STYLE" />
- <BugPattern abbrev="SPP" type="SPP_TEMPORARY_TRIM" category="STYLE" />
+ <BugPattern abbrev="SPP" type="SPP_TEMPORARY_TRIM" category="STYLE" />
+ <BugPattern abbrev="SPP" type="SPP_STRINGBUILDER_IS_MUTABLE" 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" />
@@ -356,6 +359,7 @@
<BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" category="CORRECTNESS" />
<BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" />
<BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" />
+ <BugPattern abbrev="LO" type="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_SUSPECT_LOG_PARAMETER" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_STUTTERED_MESSAGE" category="STYLE" />
@@ -413,4 +417,5 @@
<BugPattern abbrev="CU" type="CU_CLONE_USABILITY_OBJECT_RETURN" category="STYLE" />
<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" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-02-10 02:29:13 UTC (rev 1741)
+++ trunk/fb-contrib/etc/messages.xml 2013-03-04 04:47:55 UTC (rev 1742)
@@ -145,9 +145,10 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.DubiousListCollection">
<Details>
<![CDATA[
- <p> Looks for constructors of non final classes that make method calls to non final methods.
- As these methods could be overridden, the overridden method will be accessing an object that
- is only partially constructed, perhaps causing problems.</p>
+ <p> looks for fields that are implementations of java.util.List, but that are used in a set-like fashion.
+ Since lookup type operations are performed using a linear search for Lists, the performance for large
+ Lists will be poor. Consideration should be made as to whether these fields should be sets. In the
+ case that order is important, consider using LinkedHashSet.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -284,8 +285,7 @@
thread itself, introducing client calls will confuse the thread state of the object
in question, and will cause spurious thread state changes, either waking threads up
when not intended, or removing the the thread from the runnable state.</p>
- </p>
- <p>It is a fast detector</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -319,8 +319,7 @@
<![CDATA[
<p>Looks for methods that store the return result in a local variable, and
then immediately returns that local variable.</p>
- </p>
- <p>It is a fast detector</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -329,8 +328,7 @@
<Details>
<![CDATA[
<p>Looks for methods that are direct copies of the implementation in the super class</p>
- </p>
- <p>It is a fast detector</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -343,8 +341,7 @@
do not, and cannot define an equals method, reference equality is used for these
collections, which is probably not desired. If it is, consider using the IdentityHashMap
class when using Maps in this case, to better document your intentions.</p>
- </p>
- <p>It is a fast detector</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -1256,6 +1253,7 @@
Comparing class name ignores the class loader.
</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -1267,6 +1265,7 @@
classes are available in versions of the JDK 5.0 and higher, and these
classes should only be used if you are targeting JDK 1.4 and lower.
</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -1278,6 +1277,7 @@
not swallow CloneNotSupportedException. Not doing so makes the clone method not as simple to use,
and should be harmless to do so.
</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -1289,10 +1289,24 @@
This does not produce a list that holds the primitive boxed values, but a list of
one item, the array itself.
</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections">
+ <Details>
+ <![CDATA[
+ <p> Looks for methods that create collections using the default constructor,
+ even though the number of elements that will be placed in the collection is known
+ apriori, and thus could be pre-allocated. Not doing so just causes more intermediate
+ reallocations which is unnecessary.
+ </p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
<!-- BugPattern -->
<BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING">
@@ -1499,7 +1513,7 @@
<Details>
<![CDATA[
<p>This method uses floating point variables to index a loop. Since floating point
- math is inprecise, rounding errors will accumulate over time each time the loop is
+ math is imprecise, rounding errors will accumulate over time each time the loop is
executed. It is usually better to use integer indexing, and calculate the new value
of the floating point number at the top of the loop body.</p>
]]>
@@ -2542,6 +2556,19 @@
</Details>
</BugPattern>
+ <BugPattern type="SPP_STRINGBUILDER_IS_MUTABLE">
+ <ShortDescription>Method needlessly assigns a StringBuilder to itself, as it's mutable</ShortDescription>
+ <LongDescription>Method {1} needlessly assigns a StringBuilder to itself, as it's mutable</LongDescription>
+ <Details>
+ <![CDATA[
+ This method calls StringBuilder.append and assigns the results to the same StringBuilder as
+ <pre>sb = sb.append("foo")</pre>
+ As StringBuilder is mutable this is not necessary.
+ This is also true of StringBuffer.
+ ]]>
+ </Details>
+ </BugPattern>
+
<BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE">
<ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription>
<LongDescription>Method {1} assigns a variable in a larger scope then is needed</LongDescription>
@@ -2815,6 +2842,19 @@
</Details>
</BugPattern>
+ <BugPattern type="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE">
+ <ShortDescription>Method incorrectly passes exception as first argument to logger method</ShortDescription>
+ <LongDescription>Method {1} incorrectly passes exception as first argument to logger method</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method passes an exception as the first argument to a logger method. The stack
+ trace is potentially lost due to the logger emitting the exception using toString(). It
+ is better to construct a log message with sufficient context and pass the exception as
+ the second argument to capture the stack trace.</p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<BugPattern type="LO_SUSPECT_LOG_CLASS">
<ShortDescription>Method specifies an unrelated class when allocating a Logger</ShortDescription>
<LongDescription>Method {1} specifies an unrelated class when allocating a Logger</LongDescription>
@@ -3096,7 +3136,7 @@
<Details>
<![CDATA[
<p>This method tests a field to make sure it's not null before executing a conditional block of
- code. However in the conditional block is reassigns the field. It is likely that the guard
+ code. However in the conditional block it reassigns the field. It is likely that the guard
should have been a check to see if the field is null, not that the field was not null.</p>
]]>
</Details>
@@ -3108,7 +3148,7 @@
<Details>
<![CDATA[
<p>This method tests a local variable to make sure it's not null before executing a conditional block of
- code. However in the conditional block is reassigns the local variable. It is likely that the guard
+ code. However in the conditional block it reassigns the local variable. It is likely that the guard
should have been a check to see if the local variable is null, not that the local variable was not null.</p>
]]>
</Details>
@@ -3518,6 +3558,19 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="PSC_PRESIZE_COLLECTIONS">
+ <ShortDescription>Method does not presize the allocation of a collection</ShortDescription>
+ <LongDescription>Method {1} does not presize the allocation of a collection</LongDescription>
+ <Details>
+ <![CDATA[
+ <p> This method allocates a collection using the default constructor even though it is known
+ apriori how many items are going to be placed in the collection (or at least a reasonable guess)
+ and thus needlessly causes intermediate reallocations of the collection.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>"
<!-- BugCode -->
@@ -3628,4 +3681,5 @@
<BugCode abbrev="BRPI">Backport concurrent reuse of public identifiers</BugCode>
<BugCode abbrev="CU">Clone Usability</BugCode>
<BugCode abbrev="CAAL">Confusing Array asList</BugCode>
+ <BugCode abbrev="PSC">Presize Collection</BugCode>
</MessageCollection>
Added: trunk/fb-contrib/samples/CAAL_Sample.java
===================================================================
--- trunk/fb-contrib/samples/CAAL_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/CAAL_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
@@ -0,0 +1,38 @@
+import java.util.Arrays;
+import java.util.List;
+
+
+public class CAAL_Sample {
+
+ public void testCAAL(int[] v) {
+ List l = Arrays.asList(v);
+ }
+
+ public void testCAAL(char[] v) {
+ List l = Arrays.asList(v);
+ }
+
+ public void testCAAL(byte[] v) {
+ List l = Arrays.asList(v);
+ }
+
+ public void testCAAL(short[] v) {
+ List l = Arrays.asList(v);
+ }
+
+ public void testCAAL(long[] v) {
+ List l = Arrays.asList(v);
+ }
+
+ public void testCAAL(float[] v) {
+ List l = Arrays.asList(v);
+ }
+
+ public void testCAAL(double[] v) {
+ List l = Arrays.asList(v);
+ }
+
+ public void testCAAL(boolean[] v) {
+ List l = Arrays.asList(v);
+ }
+}
Property changes on: trunk/fb-contrib/samples/CAAL_Sample.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/fb-contrib/samples/CU_Sample.java
===================================================================
--- trunk/fb-contrib/samples/CU_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/CU_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
@@ -0,0 +1,17 @@
+
+public class CU_Sample implements Cloneable {
+
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ class CU_FP implements Cloneable {
+ public CU_FP clone() {
+ try {
+ return (CU_FP) super.clone();
+ } catch (CloneNotSupportedException cnse) {
+ throw new Error("Won't happen");
+ }
+ }
+ }
+}
Property changes on: trunk/fb-contrib/samples/CU_Sample.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/fb-contrib/samples/PSC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/PSC_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/PSC_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
@@ -0,0 +1,45 @@
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+
+public class PSC_Sample {
+
+ public void testPSC(List<PSC_Sample> samples) {
+ Set<String> names = new HashSet<String>();
+ for (PSC_Sample s : samples) {
+ names.add(s.toString());
+ }
+ }
+
+ public void testPSCEnumerated() {
+ Set<String> commonWords = new HashSet<String>();
+ commonWords.add("a");
+ commonWords.add("an");
+ commonWords.add("the");
+ commonWords.add("by");
+ commonWords.add("of");
+ commonWords.add("and");
+ commonWords.add("or");
+ commonWords.add("in");
+ commonWords.add("with");
+ commonWords.add("my");
+ commonWords.add("I");
+ commonWords.add("on");
+ commonWords.add("over");
+ commonWords.add("under");
+ commonWords.add("it");
+ commonWords.add("they");
+ commonWords.add("them");
+ }
+
+ public void testFPDontHaveCollectionForSizing(Iterator<Long> it) {
+ Deque<Long> ad = new ArrayDeque<Long>();
+ while (it.hasNext()) {
+ ad.add(it.next());
+ }
+ }
+}
Property changes on: trunk/fb-contrib/samples/PSC_Sample.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Modified: trunk/fb-contrib/samples/SPP_Sample.java
===================================================================
--- trunk/fb-contrib/samples/SPP_Sample.java 2013-02-10 02:29:13 UTC (rev 1741)
+++ trunk/fb-contrib/samples/SPP_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
@@ -18,40 +18,40 @@
public class SPP_Sample implements Serializable
{
public static final long serialVersionUID = -2766574418713802220L;
-
+
private static final double pi = 3.14;
private static final double e = 2.72;
public static final String FALSE_POSITIVE = "INTERN_OK_HERE".intern();
-
+
static enum Flap { Smack, Jack };
-
+
public void testSPPBitSet(BitSet b)
{
b.set(-1);
}
-
+
public String testSPPIntern()
{
return "FOO".intern(); //and yes i've seen this!
}
-
+
public String testSBWithChars()
{
StringBuffer sb = new StringBuffer('v');
sb.append("ictory");
return sb.toString();
}
-
+
public double area(double radius)
{
return pi * radius * radius;
}
-
+
public void testStutter(String s)
{
String a = a = s;
}
-
+
public void testNAN(double d)
{
if (d == Double.NaN)
@@ -59,7 +59,7 @@
System.out.println("It's a nan");
}
}
-
+
public void testNAN(float f)
{
if (f == Float.NaN)
@@ -67,17 +67,17 @@
System.out.println("It's a nan");
}
}
-
+
public void testBigDecimal()
{
BigDecimal d = new BigDecimal(2.1);
}
-
+
public void testEmptySB()
{
StringBuffer sb = new StringBuffer("");
}
-
+
public void equalsOnEnum(Flap f)
{
if (f.equals(Flap.Jack))
@@ -85,7 +85,7 @@
System.out.println("Flap Jacks");
}
}
-
+
public void testCPPBoolean(Boolean a, Boolean b, Boolean c, Boolean d, Boolean e)
{
if (b && b.booleanValue())
@@ -97,7 +97,7 @@
System.out.println("Booya");
}
}
-
+
public char usechatAt(String s)
{
if (s.length() > 0)
@@ -106,32 +106,32 @@
}
return ' ';
}
-
+
public boolean testUselessTrinary(boolean b)
{
return (b ? true : false);
}
-
+
public boolean testFPUselessTrinary(boolean a, boolean b)
{
if (a && b)
{
return a || b;
}
-
+
return a && b;
}
-
+
public boolean testFPTrinaryOnInt(String s)
{
return (s.length() != 0);
}
-
+
public void testSuspiciousStringTests(String s)
{
int a = 0, b = 0, c = 0, d = 0;
String e = "Foo";
-
+
if ((s == null) || (s.length() > 0))
{
System.out.println("Booya");
@@ -144,7 +144,7 @@
{
System.out.println("Booya");
}
-
+
if ((e == null) || (e.length() > 0))
{
System.out.println("Booya");
@@ -158,42 +158,42 @@
System.out.println("Booya");
}
}
-
+
public void testFPSST(String s)
{
int a = 0, b = 0, c = 0, d = 0;
String e = "Foo";
-
+
if ((s == null) || (s.length() == 0))
{
System.out.println("Booya");
}
-
+
if ((s != null) && (s.length() >= 0))
{
System.out.println("Booya");
}
-
+
if ((s != null) && (s.length() != 0))
{
System.out.println("Booya");
}
-
+
if ((e == null) || (e.length() == 0))
{
System.out.println("Booya");
}
-
+
if ((e != null) && (e.length() >= 0))
{
System.out.println("Booya");
}
-
+
if ((e != null) && (e.length() != 0))
{
System.out.println("Booya");
}
-
+
Set<String> m = new HashSet<String>();
Iterator<String> it = m.iterator();
while (it.hasNext())
@@ -203,11 +203,11 @@
{
continue;
}
-
+
System.out.println("Booya");
}
}
-
+
public void sbToString(StringBuffer sb)
{
if (sb.toString().length() == 0)
@@ -219,7 +219,7 @@
System.out.println("Booya");
}
}
-
+
public String cpNullOrZero(StringTokenizer tokenizer)
{
while (tokenizer.hasMoreTokens())
@@ -233,15 +233,15 @@
return sField;
}
-
+
return null;
}
-
+
public boolean testCalBeforeAfter(Calendar c, Date d)
{
return c.after(d) || c.before(d);
}
-
+
public void testUseContainsKey(Map m)
{
if (m.keySet().contains("Foo"))
@@ -249,87 +249,92 @@
System.out.println("Yup");
}
}
-
+
public void testCollectionSizeEqualsZero(Set<String> s)
{
if (s.size() == 0)
{
System.out.println("empty");
}
-
+
if (s.size() <= 0)
{
System.out.println("empty");
}
}
-
+
public boolean testDerivedGregorianCalendar()
{
Calendar c = new GregorianCalendar() {};
Calendar s = new GregorianCalendar();
-
+
return s.after(c);
}
-
+
public void testGetProperties()
{
String lf = System.getProperties().getProperty("line.separator");
}
-
+
public boolean testCasing(String a, String b)
{
if (a.toUpperCase().equalsIgnoreCase(b)) {
return true;
}
-
+
if (a.toLowerCase().compareToIgnoreCase(b) == 0) {
return true;
}
-
+
return false;
}
-
+
public void castRandomToInt() {
int i = (int)Math.random();
-
+
Random r = new Random();
i = (int) r.nextDouble();
-
+
i = (int) r.nextFloat();
}
-
+
public void testSAC(List<String> input)
{
String[] copy = new String[input.size()];
System.arraycopy(input, 0, copy, 0, copy.length);
-
+
System.arraycopy(copy, 0, input, 0, copy.length);
}
-
+
public void testArray()
{
List<String> notAnArray = new ArrayList<String>();
-
+
Array.getLength(notAnArray);
-
+
Array.getBoolean(notAnArray, 0);
-
+
Array.setInt(notAnArray, 0, 1);
}
-
+
public boolean testEmptyIgnoreCase(String s)
{
return (s.equalsIgnoreCase(""));
}
-
+
public void testTrim(String s)
{
if (s.trim().length() > 0)
System.out.println(s);
-
+
if (s.trim().equals("Booyah"))
{
System.out.println("Booyah->" + s);
}
}
+
+ public void testSBAssigning(StringBuilder sb) {
+ sb = sb.append("foo");
+ sb = sb.append("foo").append("boo").append("hoo");
+ }
}
Modified: trunk/fb-contrib/samples/WOC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/WOC_Sample.java 2013-02-10 02:29:13 UTC (rev 1741)
+++ trunk/fb-contrib/samples/WOC_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
@@ -101,4 +101,22 @@
{
return ws.fpList;
}
+
+ public static class FpContains {
+ private List<String> fpSet;
+
+ public FpContains() {
+ fpSet = new ArrayList<String>();
+ }
+ public void add() {
+ fpSet.add("Foo");
+ }
+ protected void contains() {
+ for (int i = 0; i < 10; i++) {
+ if (fpSet.get(i) != null) {
+ System.out.println("Contains");
+ }
+ }
+ }
+ }
}
Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java (rev 0)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java 2013-03-04 04:47:55 UTC (rev 1742)
@@ -0,0 +1,110 @@
+/*
+ * fb-contrib - Auxiliary detectors for Java programs
+ * Copyright (C) 2005-2013 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package com.mebigfatguy.fbcontrib.detect;
+
+import org.apache.bcel.Repository;
+import org.apache.bcel.classfile.ExceptionTable;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.classfile.Method;
+
+import edu.umd.cs.findbugs.BugInstance;
+import edu.umd.cs.findbugs.BugReporter;
+import edu.umd.cs.findbugs.Detector;
+import edu.umd.cs.findbugs.ba.ClassContext;
+import edu.umd.cs.findbugs.visitclass.PreorderVisitor;
+
+/**
+ * finds classes that implement clone() that do not specialize the return value, and do
+ * not swallow CloneNotFoundException. Not doing so makes the clone method not as simple
+ * to use, and should be harmless to do.
+ */
+public class CloneUsability extends PreorderVisitor implements Detector {
+
+ private static JavaClass CLONE_CLASS;
+
+ static {
+ try {
+ CLONE_CLASS = Repository.lookupClass("java.lang.Cloneable");
+ } catch (ClassNotFoundException cnfe) {
+ CLONE_CLASS = null;
+ }
+ }
+
+ private BugReporter bugReporter;
+ private String clsName;
+
+ /**
+ * constructs a CU detector given the reporter to report bugs on
+ * @param bugReporter the sync of bug reports
+ */
+ public CloneUsability(BugReporter bugReporter) {
+ this.bugReporter = bugReporter;
+ }
+
+ /**
+ * overrides the visitor to check for classes that implement Cloneable.
+ *
+ * @param classContext the context object that holds the JavaClass being parsed
+ */
+ public void visitClassContext(ClassContext classContext) {
+ try {
+ JavaClass cls = classContext.getJavaClass();
+ if (cls.implementationOf(CLONE_CLASS)) {
+ clsName = cls.getClassName();
+ cls.accept(this);
+ }
+ } catch (ClassNotFoundException cnfe) {
+ bugReporter.reportMissingClass(cnfe);
+ }
+ }
+
+ /**
+ * overrides the visitor to grab the method name and reset the state.
+ *
+ * @param obj the method being parsed
+ */
+ @Override
+ public void visitMethod(Method obj) {
+ if (obj.isPublic() && !obj.isSynthetic() && obj.getName().equals("clone") && (obj.getArgumentTypes().length == 0)) {
+
+ String returnClsName = obj.getReturnType().getSignature();
+ returnClsName = returnClsName.substring(1, returnClsName.length() - 1).replaceAll("/", ".");
+ if (!clsName.equals(returnClsName))
+ {
+ bugReporter.reportBug(new BugInstance(this, "CU_CLONE_USABILITY_OBJECT_RETURN", NORMAL_PRIORITY)
+ .addClass(this)
+ .addMethod(this));
+ }
+
+ ExceptionTable et = obj.getExceptionTable();
+
+ if ((et != null) && (et.getLength() > 0)) {
+ b...
[truncated message content] |
|
From: <dbr...@us...> - 2013-04-18 18:17:00
|
Revision: 1743
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1743&view=rev
Author: dbrosius
Date: 2013-04-18 18:16:49 +0000 (Thu, 18 Apr 2013)
Log Message:
-----------
merge from github
Modified Paths:
--------------
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/samples/CU_Sample.java
trunk/fb-contrib/samples/JAO_Sample.java
trunk/fb-contrib/samples/PRMC_Sample.java
trunk/fb-contrib/samples/PSC_Sample.java
trunk/fb-contrib/samples/SPP_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2013-03-04 04:47:55 UTC (rev 1742)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-04-18 18:16:49 UTC (rev 1743)
@@ -132,7 +132,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast"
- reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE" />
+ reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
@@ -157,7 +157,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingFunctionSemantics" speed="fast" reports="CFS_CONFUSING_FUNCTION_SEMANTICS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.JUnitAssertionOddities" speed="fast"
- reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT,JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" />
+ reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT,JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL,JAO_JUNIT_ASSERTION_ODDITIES_ASSERT_USED,JAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_EQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousCloneAlgorithm" speed="fast" reports="SCA_SUSPICIOUS_CLONE_ALGORITHM" />
@@ -234,12 +234,16 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers" speed="fast" reports="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_THROWS" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_MISMATCHED_RETURN,CU_CLONE_USABILITY_THROWS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.UnboundMethodTemplateParameter" speed="fast" reports="UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.NonProductiveMethodCall" speed="fast" reports="NPMC_NON_PRODUCTIVE_METHOD_CALL" />
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -338,6 +342,8 @@
<BugPattern abbrev="SPP" type="SPP_EMPTY_CASING" category="STYLE" />
<BugPattern abbrev="SPP" type="SPP_TEMPORARY_TRIM" category="STYLE" />
<BugPattern abbrev="SPP" type="SPP_STRINGBUILDER_IS_MUTABLE" category="CORRECTNESS" />
+ <BugPattern abbrev="SPP" type="SPP_USE_GET0" category="PERFORMANCE" />
+ <BugPattern abbrev="SPP" type="SPP_DOUBLE_APPENDED_LITERALS" category="PERFORMANCE" />
<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" />
@@ -355,7 +361,9 @@
<BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT" category="STYLE" />
<BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE" category="STYLE" />
<BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT" category="STYLE" />
- <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" />
+ <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" />
+ <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_ASSERT_USED" category="CORRECTNESS" />
+ <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_EQUALS" category="CORRECTNESS" />
<BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" category="CORRECTNESS" />
<BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" />
<BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" />
@@ -415,7 +423,10 @@
<BugPattern abbrev="CCNE" type="CCNE_COMPARE_CLASS_EQUALS_NAME" category="CORRECTNESS" />
<BugPattern abbrev="BRPI" type="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" category ="PERFORMANCE" />
<BugPattern abbrev="CU" type="CU_CLONE_USABILITY_OBJECT_RETURN" category="STYLE" />
+ <BugPattern abbrev="CU" type="CU_CLONE_USABILITY_MISMATCHED_RETURN" category="STYLE" />
<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="UMTP" type="UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER" category="CORRECTNESS" />
+ <BugPattern abbrev="NPMC" type="NPMC_NON_PRODUCTIVE_METHOD_CALL" category="CORRECTNESS" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-03-04 04:47:55 UTC (rev 1742)
+++ trunk/fb-contrib/etc/messages.xml 2013-04-18 18:16:49 UTC (rev 1743)
@@ -74,8 +74,8 @@
<Details>
<![CDATA[
<p> Looks for for loops that iterate over a java.util.List using an integer index, and get,
- rather than using an Iterator. An iterator may perform better depending List implementation,
- but more importantly will allow the code to be converted to other collections type.</p>
+ rather than using an Iterator. An iterator may perform better depending on List implementation,
+ but more importantly will allow the code to be converted to other collection types.</p>
<p>It is a moderately fast detector</p>
]]>
</Details>
@@ -85,7 +85,7 @@
<Details>
<![CDATA[
<p> Looks for collections or arrays that hold objects that are unrelated thru class or
- interface inheritance other than java.lang.Object. Doing so, makes for brittle code,
+ 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 seperate class,
which defines the different types required, and add an instance of that class to the
@@ -101,7 +101,7 @@
<p> Looks for methods that declare Runtime exceptions in their throws clause. While doing
so is not illegal, it may represent a misunderstanding as to the exception in question.
If a RuntimeException is declared, it implies that this exception type is expected to happen,
- which if true, should be handled in code, and not propogated. </p>
+ which if true should be handled in code, and not propagated. </p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -159,7 +159,8 @@
<![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.</p>
+ all of these pieces of information, and place instances of this class in one list. Or if the two list are
+ related in key/value fashion, then a map.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -293,8 +294,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessAutoboxing">
<Details>
<![CDATA[
- <p> Looks for methods that pass a primitive wrapper class object, to the
- same classes Constructor. Patterns found are:
+ <p> Looks for methods that pass a primitive wrapper class object to the
+ same class' Constructor. Patterns found are:
<ul>
<li>new Boolean(Boolean)</li>
<li>new Byte(Byte)</li>
@@ -317,7 +318,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn">
<Details>
<![CDATA[
- <p>Looks for methods that store the return result in a local variable, and
+ <p>Looks for methods that store the return result in a local variable and
then immediately returns that local variable.</p>
<p>It is a fast detector</p>
]]>
@@ -622,7 +623,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.LostExceptionStackTrace">
<Details>
<![CDATA[
- <p>Looks for methods that catch exceptions, and then throw a different exception,
+ <p>Looks for methods that catch exceptions, and then throw a different exception
without embedding the original exception in the thrown one. Doing so, hides the real
source of the exception, making debugging and fixing these problems difficult.</p>
<p>It is a moderately fast detector</p>
@@ -710,7 +711,7 @@
<Details>
<![CDATA[
<p>Looks for classes that implement interfaces by relying on methods being
- implemented in superclasses, even tho the superclass knows nothing about
+ implemented in superclasses, even though the superclass knows nothing about
the interface being implemented by the child.</p>
<p>It is a fast detector.</p>
]]>
@@ -836,6 +837,7 @@
<li>Passing a constant as the second (actual) parameter</li>
<li>not using the three parameter version of asserts for doubles</li>
<li>Passing true or false as the first parameter instead of using assertTrue, or assertFalse</li>
+ <li>Using the assert keyword</li>
</ul>
</p>
<p>It is a fast detector</p>
@@ -1098,7 +1100,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ReflectionOnObjectMethods">
<Details>
<![CDATA[
- <p>This detector looks for reflective calls on methods that are found java.lang.Object.
+ <p>This detector looks for reflective calls on methods that are found in the class java.lang.Object.
As these methods are always available, there is no reason to use reflection to call them.
</p>
<p>It is a fast detector</p>
@@ -1295,7 +1297,7 @@
</Detector>
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections">
- <Details>
+ <Details>
<![CDATA[
<p> Looks for methods that create collections using the default constructor,
even though the number of elements that will be placed in the collection is known
@@ -1307,6 +1309,30 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.UnboundMethodTemplateParameter">
+ <Details>
+ <![CDATA[
+ <p> Looks for methods that declare method level template parameter(s) that are not bound to any of the
+ method's parameters, and thus is not adding any validation/type safety to the method, and is
+ just confusing.
+ </p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.NonProductiveMethodCall">
+ <Details>
+ <![CDATA[
+ <p> Looks for common methods that are non mutating where the return value is ignored. As these methods
+ do not change the object they are called on, calling this methods is pointless. They can be removed.
+ </p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
+
<!-- BugPattern -->
<BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING">
@@ -1314,7 +1340,7 @@
<LongDescription>Method {1} passes simple concatenating string in StringBuffer or StringBuilder append</LongDescription>
<Details>
<![CDATA[
- <p> This method uses StringBuffer or StringBuilder append to concatenate strings. However, it passes the result
+ <p> This method uses StringBuffer or StringBuilder's append method to concatenate strings. However, it passes the result
of doing a simple String concatenation to one of these append calls, thus removing any performance gains
of using the StringBuffer or StringBuilder class.</p>
]]>
@@ -2568,6 +2594,28 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="SPP_USE_GET0">
+ <ShortDescription>Method uses iterator().next() on a List to get the first item</ShortDescription>
+ <LongDescription>Method {1} uses iterator().next() on a List to get the first item</LongDescription>
+ <Details>
+ <![CDATA[
+ This Method calls myList.iterator().next() on a List to get the first item. It is more performant
+ to just use myList.get(0).
+ ]]>
+ </Details>
+ </BugPattern>
+
+ <BugPattern type="SPP_DOUBLE_APPENDED_LITERALS">
+ <ShortDescription>Method appends two literal strings back to back to a StringBuilder</ShortDescription>
+ <LongDescription>Method {1} appends two literal strings back to back to a StringBuilder</LongDescription>
+ <Details>
+ <![CDATA[
+ This method appends two literal strings to a StringBuilder back to back. This can be done with just
+ one append call, and may avoid intermediate reallocations of the StringBuilders backing store.
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE">
<ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription>
@@ -2804,6 +2852,30 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="JAO_JUNIT_ASSERTION_ODDITIES_ASSERT_USED">
+ <ShortDescription>Method uses java asserts rather than a junit assertion</ShortDescription>
+ <LongDescription>Method {1} uses java asserts rather than a junit assertion</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method uses a java assert to assure that a certain state is in effect. As this is
+ a junit test it makes more sense to either check this condition with a junit assert, or allow
+ a following exception to occur.</p>
+ ]]>
+ </Details>
+ </BugPattern>
+
+ <BugPattern type="JAO_JUNIT_ASSERTION_ODDITIES_USE_ASSERT_EQUALS">
+ <ShortDescription>Method passes boolean expression to Assert.assertTrue</ShortDescription>
+ <LongDescription>Method {1} passes boolean expression to Assert.assertTrue</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method evaluates a boolean expression and passes that to Assert.assertTrue. It is better
+ to pass the two values that are being equated to the Assert.assertEquals method so that the
+ junit failure method is more meaningful of the intended test.</p>
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="SCA_SUSPICIOUS_CLONE_ALGORITHM">
<ShortDescription>Clone method stores a new value to member field of source object</ShortDescription>
@@ -3529,6 +3601,18 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="CU_CLONE_USABILITY_MISMATCHED_RETURN">
+ <ShortDescription>Clone method declares it returns an type different then the owning class</ShortDescription>
+ <LongDescription>Clone method {1} declares it returns an type different then the owning class</LongDescription>
+ <Details>
+ <![CDATA[
+ <p> This class implements the Cloneable interface but defines its clone method to return a type
+ that is different than the class itself, or any interfaces that the class implements.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="CU_CLONE_USABILITY_THROWS">
<ShortDescription>Clone method declares it throws CloneNotSupportedException</ShortDescription>
@@ -3570,7 +3654,31 @@
</p>
]]>
</Details>
- </BugPattern>"
+ </BugPattern>
+
+ <BugPattern type="UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER">
+ <ShortDescription>Method declares unbound method template parameter(s)</ShortDescription>
+ <LongDescription>Method {1} declares unbound method template parameter(s)</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method declares a method level template parameter that is not bound by any parameter of this
+ method. Therefore the template parameter adds no validation or type safety and can be removed, as it's
+ just confusing to the reader.
+ ]]>
+ </Details>
+ </BugPattern>
+
+ <BugPattern type="NPMC_NON_PRODUCTIVE_METHOD_CALL">
+ <ShortDescription>Method ignores return value of a non mutating method</ShortDescription>
+ <LongDescription>Method {1} ignores return value of a non mutating method</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method ignores the return value of a common method that is assumed to be none mutating.
+ If this method does in fact not modify the object it is called on, there is no reason to call
+ this method, and it can be removed.
+ ]]>
+ </Details>
+ </BugPattern>
<!-- BugCode -->
@@ -3682,4 +3790,6 @@
<BugCode abbrev="CU">Clone Usability</BugCode>
<BugCode abbrev="CAAL">Confusing Array asList</BugCode>
<BugCode abbrev="PSC">Presize Collection</BugCode>
+ <BugCode abbrev="UMTP">Unbound Method Template Parameter</BugCode>
+ <BugCode abbrev="NPMC">Non Productive Method Call</BugCode>
</MessageCollection>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2013-03-04 04:47:55 UTC (rev 1742)
+++ trunk/fb-contrib/htdocs/index.shtml 2013-04-18 18:16:49 UTC (rev 1743)
@@ -86,6 +86,22 @@
same kind of exception, and throw the same exception always. These blocks can
be coalesced into one.
</li>
+ <li><b>[PSC] Presize Collections</b><br/>
+ Looks for 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.
+ </li>
+ <li><b>[UMTP] Unbound Method Template Parameter</b><br/>
+ Looks for methods that declare method level template parameter(s) that are not bound to any of
+ the method's parameters, and thus is not adding any validation/type safety to the method,
+ and is just confusing.
+ </li>
+ <li><b>[NPMC] Non Productive Method Call</b><br/>
+ Looks for common methods that are believed to be non mutating, where the value
+ is discarded. Since the method makes no changes to the object, calling this method
+ is useless. The method call can be removed.
+ </li>
</ul>
</div>
<hr/>
Modified: trunk/fb-contrib/samples/CU_Sample.java
===================================================================
--- trunk/fb-contrib/samples/CU_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
+++ trunk/fb-contrib/samples/CU_Sample.java 2013-04-18 18:16:49 UTC (rev 1743)
@@ -14,4 +14,27 @@
}
}
}
+
+ class Unrelated implements Cloneable {
+ public String clone() {
+ try {
+ return (String) super.clone();
+ } catch (CloneNotSupportedException cnse) {
+ throw new Error("Won't happen");
+ }
+ }
+ }
+
+ class FPCloneInterface implements Cloneable, Runnable {
+ public Runnable clone() {
+ try {
+ return (Runnable) super.clone();
+ } catch (CloneNotSupportedException cnse) {
+ throw new Error("Won't happen");
+ }
+ }
+
+ public void run() {
+ }
+ }
}
Modified: trunk/fb-contrib/samples/JAO_Sample.java
===================================================================
--- trunk/fb-contrib/samples/JAO_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
+++ trunk/fb-contrib/samples/JAO_Sample.java 2013-04-18 18:16:49 UTC (rev 1743)
@@ -3,35 +3,45 @@
-public class JAO_Sample extends TestCase
+public class JAO_Sample extends TestCase
{
-
+
public void testExactDoubles(double d1, double d2)
{
Assert.assertEquals(d1, d2);
}
-
+
public void testTrue(boolean b)
{
Assert.assertEquals(true, b);
}
-
+
public void testFalse(boolean b)
{
Assert.assertEquals("Wow this is bad", false, b);
}
-
+
public void testWrongOrder(int i)
{
Assert.assertEquals(i, 10);
}
-
+
public void testAutoBoxNotNull(int i)
{
Assert.assertNotNull(i);
Assert.assertNotNull(i == 3);
}
+
+ public void testAssertUsed(String s)
+ {
+ assert s != null;
+ }
+ public void testUseAssertEquals(String s, String s2) {
+ Assert.assertTrue(s.equals(s2));
+ Assert.assertTrue(s.length() == s.length());
+ }
+
public void test3ArgNP(float foo)
{
Assert.assertEquals(1.0f, foo, 0.1);
Modified: trunk/fb-contrib/samples/PRMC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/PRMC_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
+++ trunk/fb-contrib/samples/PRMC_Sample.java 2013-04-18 18:16:49 UTC (rev 1743)
@@ -92,4 +92,35 @@
}
enum FPEnum { fee, fi, fo, fum };
+
+
+ public boolean validChainedFields(Chain c1) {
+ return c1.chainedField.toString().equals(c1.chainedField.toString());
+ }
+
+ public boolean fpChainedFieldsOfDiffBases(Chain c1, Chain c2)
+ {
+ return c1.chainedField.toString().equals(c2.chainedField.toString());
+ }
+
+ class Chain
+ {
+ public Chain chainedField;
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("--");
+ sb.append("XX");
+ sb.append("--");
+ sb.append("XX");
+ sb.append("--");
+ sb.append("XX");
+ sb.append("--");
+ sb.append("XX");
+ sb.append("--");
+ sb.append("XX");
+ sb.append("--");
+ return sb.toString();
+ }
+ }
}
Modified: trunk/fb-contrib/samples/PSC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/PSC_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
+++ trunk/fb-contrib/samples/PSC_Sample.java 2013-04-18 18:16:49 UTC (rev 1743)
@@ -1,8 +1,13 @@
+import java.io.BufferedReader;
+import java.io.IOException;
import java.util.ArrayDeque;
+import java.util.ArrayList;
import java.util.Deque;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
@@ -36,10 +41,55 @@
commonWords.add("them");
}
- public void testFPDontHaveCollectionForSizing(Iterator<Long> it) {
+ public void fpDontHaveCollectionForSizing(Iterator<Long> it) {
Deque<Long> ad = new ArrayDeque<Long>();
while (it.hasNext()) {
ad.add(it.next());
}
}
+
+ public void fpConditionalInLoop(Set<String> source) {
+ List<String> dest = new ArrayList<String>();
+ for (String s : source) {
+ if (s.length() > 0) {
+ dest.add(s);
+ }
+ }
+ }
+
+ public void fpSwitchInLoop(Set<Integer> source) {
+ List<Integer> dest = new ArrayList<Integer>();
+ for (Integer s : source) {
+ switch (s.intValue()) {
+ case 0:
+ dest.add(s);
+ break;
+ case 1:
+ dest.remove(s);
+ break;
+ }
+ }
+ }
+
+ public void fpAllocationInLoop(Map<String, String> source) {
+ Map<String, List<String>> dest = new HashMap<String, List<String>>();
+
+ for (Map.Entry<String, String> entry : source.entrySet()) {
+
+ List<String> l = new ArrayList<String>();
+ l.add(entry.getValue());
+ dest.put(entry.getKey(), l);
+ }
+ }
+
+ public List<String> fpUnknownSrcSize(BufferedReader br) throws IOException {
+ List<String> l = new ArrayList<String>();
+ String line;
+ while ((line = br.readLine()) != null) {
+ l.add(line);
+ }
+
+ return l;
+
+ }
}
Modified: trunk/fb-contrib/samples/SPP_Sample.java
===================================================================
--- trunk/fb-contrib/samples/SPP_Sample.java 2013-03-04 04:47:55 UTC (rev 1742)
+++ trunk/fb-contrib/samples/SPP_Sample.java 2013-04-18 18:16:49 UTC (rev 1743)
@@ -111,6 +111,13 @@
{
return (b ? true : false);
}
+
+ public void testDoubleAppendLiteral(StringBuilder sb, String s)
+ {
+ sb.append("hello").append("there");
+ sb.append("Hello").append(s).append("there");
+ }
+
public boolean testFPUselessTrinary(boolean a, boolean b)
{
@@ -337,4 +344,8 @@
sb = sb.append("foo");
sb = sb.append("foo").append("boo").append("hoo");
}
+
+ public String testListFirst(List<String> l) {
+ return l.iterator().next();
+ }
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java 2013-03-04 04:47:55 UTC (rev 1742)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java 2013-04-18 18:16:49 UTC (rev 1743)
@@ -1,17 +1,17 @@
/*
* fb-contrib - Auxiliary detectors for Java programs
* Copyright (C) 2005-2013 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
@@ -24,11 +24,11 @@
{
/**
* shows the simple help
- *
+ *
* @param args standard command line args
*/
public static void main(final String[] args) {
- JOptionPane.showMessageDialog( null, "To use fb-contrib, copy this jar file into your local FindBugs plugin directory, and use FindBugs as usual.\n\nfb-contrib is a trademark of MeBigFatGuy.com\nFindBugs is a trademark of the University of Mar...
[truncated message content] |
|
From: <dbr...@us...> - 2013-04-20 17:08:19
|
Revision: 1745
http://sourceforge.net/p/fb-contrib/code/1745
Author: dbrosius
Date: 2013-04-20 17:08:15 +0000 (Sat, 20 Apr 2013)
Log Message:
-----------
prepare for 4.8.3 release
Modified Paths:
--------------
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/pom.xml
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-04-19 12:02:04 UTC (rev 1744)
+++ trunk/fb-contrib/build.xml 2013-04-20 17:08:15 UTC (rev 1745)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.9.0" />
+ <property name="fb-contrib.version" value="4.8.3" />
<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 2013-04-19 12:02:04 UTC (rev 1744)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-04-20 17:08:15 UTC (rev 1745)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
@@ -235,7 +235,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers" speed="fast" reports="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_MISMATCHED_RETURN,CU_CLONE_USABILITY_THROWS" />
-
+<!--
<Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
@@ -243,7 +243,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnboundMethodTemplateParameter" speed="fast" reports="UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonProductiveMethodCall" speed="fast" reports="NPMC_NON_PRODUCTIVE_METHOD_CALL" />
-
+-->
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2013-04-19 12:02:04 UTC (rev 1744)
+++ trunk/fb-contrib/pom.xml 2013-04-20 17:08:15 UTC (rev 1745)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>4.9.0</version>
+ <version>4.8.3</version>
<parent>
<groupId>org.sonatype.oss</groupId>
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java 2013-04-19 12:02:04 UTC (rev 1744)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java 2013-04-20 17:08:15 UTC (rev 1745)
@@ -79,7 +79,7 @@
/**
* implements the visitor to clear the opcode stack
*
- * @param seen the currently code block
+ * @param obj the currently code block
*/
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <dbr...@us...> - 2013-06-01 19:30:50
|
Revision: 1747
http://sourceforge.net/p/fb-contrib/code/1747
Author: dbrosius
Date: 2013-06-01 19:30:46 +0000 (Sat, 01 Jun 2013)
Log Message:
-----------
merge from git
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/ISB_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
Added Paths:
-----------
trunk/fb-contrib/samples/NPMC_Sample.java
trunk/fb-contrib/samples/UMTP_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/build.xml 2013-06-01 19:30:46 UTC (rev 1747)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.8.3" />
+ <property name="fb-contrib.version" value="4.9.0" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -191,8 +191,8 @@
</target>
<target name="srczip" description="builds the source distribution zip file">
- <zip destfile="${basedir}/fb-contrib-src-${fb-contrib.version}.zip" basedir="${basedir}">
- <fileset dir="${src.dir}">
+ <zip destfile="${basedir}/fb-contrib-src-${fb-contrib.version}.zip">
+ <fileset dir="${basedir}">
<include name="**/*.java" />
<include name="**/*.xml" />
<include name="**/*.xsd" />
Modified: trunk/fb-contrib/etc/bugrank.txt
===================================================================
--- trunk/fb-contrib/etc/bugrank.txt 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/etc/bugrank.txt 2013-06-01 19:30:46 UTC (rev 1747)
@@ -79,7 +79,7 @@
0 BugPattern SPP_EQUALS_ON_ENUM
0 BugPattern SPP_INVALID_BOOLEAN_NULL_CHECK
0 BugPattern SPP_USE_CHARAT
-0 BugPattern SPP_USELESS_TRINARY
+0 BugPattern SPP_USELESS_TERNARY
0 BugPattern SPP_SUSPECT_STRING_TEST
0 BugPattern SPP_USE_STRINGBUILDER_LENGTH
0 BugPattern SPP_INVALID_CALENDAR_COMPARE
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-06-01 19:30:46 UTC (rev 1747)
@@ -17,7 +17,7 @@
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering" speed="fast" reports="ISB_INEFFICIENT_STRING_BUFFERING,ISB_EMPTY_STRING_APPENDING" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering" speed="fast" reports="ISB_INEFFICIENT_STRING_BUFFERING,ISB_EMPTY_STRING_APPENDING,ISB_TOSTRING_APPENDING" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators" speed="slow" reports="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" />
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -132,7 +132,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast"
- reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING,SPP_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS" />
+ 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_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
@@ -235,7 +235,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers" speed="fast" reports="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_MISMATCHED_RETURN,CU_CLONE_USABILITY_THROWS" />
-<!--
+
<Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
@@ -243,11 +243,12 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnboundMethodTemplateParameter" speed="fast" reports="UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonProductiveMethodCall" speed="fast" reports="NPMC_NON_PRODUCTIVE_METHOD_CALL" />
--->
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
<BugPattern abbrev="ISB" type="ISB_EMPTY_STRING_APPENDING" category="PERFORMANCE" />
+ <BugPattern abbrev="ISB" type="ISB_TOSTRING_APPENDING" category="CORRECTNESS" />
<BugPattern abbrev="SCI" type="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" category="CORRECTNESS" />
<BugPattern abbrev="CC" type="CC_CYCLOMATIC_COMPLEXITY" category="STYLE" />
<BugPattern abbrev="OCP" type="OCP_OVERLY_CONCRETE_PARAMETER" category="STYLE" />
@@ -329,7 +330,7 @@
<BugPattern abbrev="SPP" type="SPP_EQUALS_ON_ENUM" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_INVALID_BOOLEAN_NULL_CHECK" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_USE_CHARAT" category="PERFORMANCE" />
- <BugPattern abbrev="SPP" type="SPP_USELESS_TRINARY" category="PERFORMANCE" />
+ <BugPattern abbrev="SPP" type="SPP_USELESS_TERNARY" category="PERFORMANCE" />
<BugPattern abbrev="SPP" type="SPP_SUSPECT_STRING_TEST" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_USE_STRINGBUILDER_LENGTH" category="PERFORMANCE" />
<BugPattern abbrev="SPP" type="SPP_INVALID_CALENDAR_COMPARE" category="CORRECTNESS" />
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/etc/messages.xml 2013-06-01 19:30:46 UTC (rev 1747)
@@ -1359,6 +1359,18 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="ISB_TOSTRING_APPENDING">
+ <ShortDescription>Method concatenates the result of a toString() call</ShortDescription>
+ <LongDescription>Method {1} concatenates the result of a toString() call</LongDescription>
+ <Details>
+ <![CDATA[
+ <p> This method concatenates the output of a toString() call into a StringBuffer/Builder.
+ It is simpler just pass the object you want to append to the to append call, as that form
+ does not suffer the potential for NullPointerExceptions, and is easier to read.</p>
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="SCI_SYNCHRONIZED_COLLECTION_ITERATORS">
<ShortDescription>Method creates iterators on synchronized collections</ShortDescription>
@@ -2431,13 +2443,13 @@
</Details>
</BugPattern>
- <BugPattern type="SPP_USELESS_TRINARY">
- <ShortDescription>Method uses a trinary operator to cast a boolean to true or false</ShortDescription>
- <LongDescription>Method {1} uses a trinary operator to cast a boolean to true or false</LongDescription>
+ <BugPattern type="SPP_USELESS_TERNARY">
+ <ShortDescription>Method uses a ternary operator to cast a boolean to true or false</ShortDescription>
+ <LongDescription>Method {1} uses a ternary operator to cast a boolean to true or false</LongDescription>
<Details>
<![CDATA[
- <p>This method tests the value of a boolean and using a trinary operator to return either true or false.
- The trinary operator is completely unecessary, just use the original boolean value.</p>
+ <p>This method tests the value of a boolean and using a ternary operator to return either true or false.
+ The ternary operator is completely unecessary, just use the original boolean value.</p>
]]>
</Details>
</BugPattern>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/htdocs/index.shtml 2013-06-01 19:30:46 UTC (rev 1747)
@@ -73,9 +73,9 @@
</div>
<hr/>
- <img id="svn_image" src="flip1.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/>
+ <img id="svn_image" src="flip2.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/>
Detectors added in svn<br/>
- <div id="svn" style="display:none;">
+ <div id="svn" style="display:block;">
<ul>
<li><b>[CVAA] ContraVariant Array Assignment</b><br/>
Looks for contravariant array assignments. Since arrays are mutable data structures, their use
@@ -86,6 +86,11 @@
same kind of exception, and throw the same exception always. These blocks can
be coalesced into one.
</li>
+ <li><b>[CAAL] Confusing Array As List</b><br/>
+ Looks for calls to Arrays.asList where the parameter is a primitive array.
+ This does not produce a list that holds the primitive boxed value, but a list of
+ one item, the array itself.
+ </li>
<li><b>[PSC] Presize Collections</b><br/>
Looks for methods that create and populate collections, and while knowing
the end size of those collections, does not pre allocate the collection
@@ -105,9 +110,9 @@
</ul>
</div>
<hr/>
- <img id="v4_8_0_image" src="flip2.gif" onClick="toggleBlock('v4_8_0', 'v4_8_0_image');" align="top"/>
+ <img id="v4_8_0_image" src="flip1.gif" onClick="toggleBlock('v4_8_0', 'v4_8_0_image');" align="top"/>
Detectors added in v4.8.0<br/>
- <div id="v4_8_0" style="display:block;">
+ <div id="v4_8_0" style="display:none;">
<ul>
<li><b>[LGO] Lingering Graphics Object</b><br/>
Looks for creation of java.awt.Graphics object that do not have the
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/pom.xml 2013-06-01 19:30:46 UTC (rev 1747)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>4.8.3</version>
+ <version>4.9.0</version>
<parent>
<groupId>org.sonatype.oss</groupId>
Modified: trunk/fb-contrib/samples/ISB_Sample.java
===================================================================
--- trunk/fb-contrib/samples/ISB_Sample.java 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/samples/ISB_Sample.java 2013-06-01 19:30:46 UTC (rev 1747)
@@ -68,6 +68,12 @@
return sb.toString();
}
+ public String testTOStringAppending() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(this.toString());
+ return sb.toString();
+ }
+
@Override
public String toString()
{
Added: trunk/fb-contrib/samples/NPMC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/NPMC_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/NPMC_Sample.java 2013-06-01 19:30:46 UTC (rev 1747)
@@ -0,0 +1,60 @@
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+public class NPMC_Sample implements Cloneable
+{
+ public void testToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append("hello").append("world").toString();
+ }
+
+ public void testXValue()
+ {
+ Integer i = Integer.valueOf(4);
+ i.intValue();
+ Long l = Long.valueOf(4);
+ l.longValue();
+ Double d = Double.valueOf(4);
+ d.doubleValue();
+ Float f = Float.valueOf(4);
+ f.doubleValue();
+ }
+
+ public void testEquals(Object o)
+ {
+ equals(o);
+ }
+
+ public void testHashCode()
+ {
+ hashCode();
+ }
+
+ public NPMC_Sample clone()
+ {
+ try
+ {
+ super.clone();
+
+ return null;
+ }
+ catch (CloneNotSupportedException cnse)
+ {
+ throw new Error();
+ }
+ }
+
+ public String[] testToArrayList()
+ {
+ List<String> l = new ArrayList<String>();
+ l.toArray();
+ Set<String> s = new HashSet<String>();
+ s.toArray();
+
+ return null;
+ }
+}
Property changes on: trunk/fb-contrib/samples/NPMC_Sample.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/fb-contrib/samples/UMTP_Sample.java
===================================================================
--- trunk/fb-contrib/samples/UMTP_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/UMTP_Sample.java 2013-06-01 19:30:46 UTC (rev 1747)
@@ -0,0 +1,38 @@
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class UMTP_Sample {
+
+ public <T, C> C getT(String s, int i, Class<C> cls) {
+ T t = (T) getFoo();
+ System.out.println(t);
+
+ return (C) new Object();
+ }
+
+ public <T> String fpUseClass(T t) {
+ return t.toString();
+ }
+
+ public <T> String fpUseClass(Class<T> c) {
+ return c.getName().toString();
+ }
+
+ public <T> String fpUseArray(T[] t) {
+ return t[0].toString();
+ }
+
+ private <K, V> Map<V, K> fpKVReverseMap(Map<K, V> map) {
+ Map<V, K> m = new HashMap<V, K>();
+ for (Map.Entry<K, V> entry : map.entrySet()) {
+ m.put(entry.getValue(), entry.getKey());
+ }
+
+ return m;
+ }
+
+ public Object getFoo() {
+ return null;
+ }
+}
Property changes on: trunk/fb-contrib/samples/UMTP_Sample.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2013-06-01 19:30:46 UTC (rev 1747)
@@ -35,6 +35,8 @@
*/
public class InefficientStringBuffering extends BytecodeScanningDetector
{
+ private enum AppendType { NONE, CLEAR, NESTED, TOSTRING };
+
private BugReporter bugReporter;
private OpcodeStack stack;
private boolean sawLDCEmpty;
@@ -77,7 +79,7 @@
@Override
public void sawOpcode(final int seen) {
- Boolean nestedSB = null;
+ AppendType apType = AppendType.NONE;
try {
stack.mergeJumps(this);
@@ -90,13 +92,13 @@
if ("()V".equals(signature)) {
OpcodeStack.Item itm = getStringBufferItemAt(2);
if (itm != null) {
- nestedSB = Boolean.TRUE;
+ apType = AppendType.NESTED;
}
} else if ("(Ljava/lang/String;)V".equals(signature)) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
- nestedSB = (Boolean)itm.getUserValue();
- if ((nestedSB != null) && nestedSB.booleanValue()) {
+ apType = (AppendType)itm.getUserValue();
+ if (apType == AppendType.NESTED) {
bugReporter.reportBug(
new BugInstance(this, "ISB_INEFFICIENT_STRING_BUFFERING", NORMAL_PRIORITY)
.addClass(this)
@@ -138,31 +140,38 @@
String methodName = getNameConstantOperand();
if ("append".equals(methodName)) {
OpcodeStack.Item itm = getStringBufferItemAt(1);
- nestedSB = (itm == null) ? null : (Boolean)itm.getUserValue();
+ apType = (itm == null) ? AppendType.NONE : (AppendType )itm.getUserValue();
if (stack.getStackDepth() > 0) {
itm = stack.getStackItem(0);
- Boolean uValue = (Boolean)itm.getUserValue();
- if ((uValue != null) && uValue.booleanValue()) {
+ AppendType apValue = (AppendType)itm.getUserValue();
+ if (apValue == AppendType.NESTED) {
bugReporter.reportBug(
new BugInstance(this, "ISB_INEFFICIENT_STRING_BUFFERING", "toString".equals(getMethodName()) ? LOW_PRIORITY : NORMAL_PRIORITY)
.addClass(this)
.addMethod(this)
.addSourceLine(this));
-
+ } else if (apValue == AppendType.TOSTRING){
+ bugReporter.reportBug(
+ new BugInstance(this, "ISB_TOSTRING_APPENDING", NORMAL_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
}
}
} else if ("toString".equals(methodName)) {
OpcodeStack.Item itm = getStringBufferItemAt(0);
- nestedSB = (itm == null) ? null : (Boolean)itm.getUserValue();
+ apType = (itm == null) ? AppendType.NONE : (AppendType)itm.getUserValue();
}
+ } else if ("toString".equals(getNameConstantOperand()) && "()Ljava/lang/String;".equals(getSigConstantOperand())) {
+ apType = AppendType.TOSTRING;
}
} else if ((seen == GOTO) || (seen == GOTO_W)) {
int depth = stack.getStackDepth();
for (int i = 0; i < depth; i++) {
OpcodeStack.Item itm = stack.getStackItem(i);
- itm.setUserValue(Boolean.FALSE);
+ itm.setUserValue(AppendType.NONE);
}
} else if ((seen == LDC) || (seen == LDC_W)) {
Constant c = getConstantRefOperand();
@@ -171,15 +180,17 @@
if (s.length() == 0)
sawLDCEmpty = true;
}
+ } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) {
+ apType = AppendType.CLEAR;
}
} finally {
TernaryPatcher.pre(stack, seen);
stack.sawOpcode(this, seen);
TernaryPatcher.post(stack, seen);
- if (nestedSB != null) {
+ if (apType != AppendType.NONE) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item itm = stack.getStackItem(0);
- itm.setUserValue(nestedSB);
+ itm.setUserValue(apType);
}
}
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2013-06-01 19:30:46 UTC (rev 1747)
@@ -267,12 +267,14 @@
}
}
} else if ("(Ljava/lang/Object;)V".equals(sig)) {
- final JavaClass clazz = stack.getStackItem(0).getJavaClass();
- if(clazz.instanceOf(THROWABLE_CLASS)) {
- bugReporter.reportBug(new BugInstance(this, "LO_LOGGER_LOST_EXCEPTION_STACK_TRACE", NORMAL_PRIORITY)
- .addClass(this)
- .addMethod(this)
- .addSourceLine(this));
+ if (stack.getStackDepth() > 0) {
+ final JavaClass clazz = stack.getStackItem(0).getJavaClass();
+ if(clazz.instanceOf(THROWABLE_CLASS)) {
+ bugReporter.reportBug(new BugInstance(this, "LO_LOGGER_LOST_EXCEPTION_STACK_TRACE", NORMAL_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
}
}
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2013-04-20 17:38:45 UTC (rev 1746)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2013-06-01 19:30:46 UTC (rev 1747)
@@ -142,7 +142,7 @@
}
} else if ((seen == GOTO) || (seen == GOTO_W)) {
if (stack.getStackDepth() > 0) {
- methodSuspect = false; //Trinaries confuse us too much, if the code has a trinary well - oh well
+ methodSuspect = false; //Trinaries confuse us too much, if the code has a ternary well - oh well
}
} else if (seen == INVOKEVIRTUAL) {
String clsName = getClassConstantOperand();
Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java (rev 0)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java 2013-06-01 19:30:46 UTC (rev 1747)
@@ -0,0 +1,138 @@
+/*
+ * fb-contrib - Auxiliary detectors for Java programs
+ * Copyright (C) 2005-2013 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package com.mebigfatguy.fbcontrib.detect;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.bcel.classfile.Code;
+
+import edu.umd.cs.findbugs.BugInstance;
+import edu.umd.cs.findbugs.BugReporter;
+import edu.umd.cs.findbugs.BytecodeScanningDetector;
+import edu.umd.cs.findbugs.OpcodeStack;
+import edu.umd.cs.findbugs.ba.ClassContext;
+
+/**
+ * looks for common methods that are believed to be non mutating, where the value
+ * is discarded. Since the method makes no changes to the object, calling this method
+ * is useless. The method call can be removed.
+ */
+public class NonProductiveMethodCall extends BytecodeScanningDetector {
+
+ private static final Set<Pattern> IMMUTABLE_METHODS = new HashSet<Pattern>();
+
+ static {
+ IMMUTABLE_METHODS.add(Pattern.compile(".*@toString\\(\\)Ljava/lang/String;"));
+ IMMUTABLE_METHODS.add(Pattern.compile("java/lang/.+@.+Value\\(\\)[BCDFIJSZ]"));
+ IMMUTABLE_METHODS.add(Pattern.compile(".*@equals\\(Ljava/lang/Object;\\)Z"));
+ IMMUTABLE_METHODS.add(Pattern.compile(".*@hashCode\\(\\)I"));
+ IMMUTABLE_METHODS.add(Pattern.compile(".*@clone\\(\\).+"));
+ IMMUTABLE_METHODS.add(Pattern.compile("java/util/.+@toArray\\(\\)\\[.+"));
+ }
+
+ private BugReporter bugReporter;
+ private OpcodeStack stack;
+
+ /**
+ * constructs a NPMC detector given the reporter to report bugs on
+ * @param bugReporter the sync of bug reports
+ */
+ public NonProductiveMethodCall(BugReporter bugReporter) {
+ this.bugReporter = bugReporter;
+ }
+
+ /**
+ * implements the visitor to set and clear the stack
+ */
+ public void visitClassContext(ClassContext classContext) {
+ try {
+ stack = new OpcodeStack();
+ super.visitClassContext(classContext);
+ } finally {
+ stack = null;
+ }
+ }
+
+ /**
+ * implements the visitor to reset the opcode stack
+ *
+ * @param obj the context object of the currently parsed code block
+ */
+ public void visitCode(Code obj) {
+ stack.resetForMethodEntry(this);
+ super.visitCode(obj);
+ }
+
+ /**
+ * implements the visitor to look for return values of common immutable method
+ * calls, that are thrown away.
+ *
+ * @param seen the...
[truncated message content] |
|
From: <dbr...@us...> - 2013-07-14 19:23:11
|
Revision: 1748
http://sourceforge.net/p/fb-contrib/code/1748
Author: dbrosius
Date: 2013-07-14 19:23:07 +0000 (Sun, 14 Jul 2013)
Log Message:
-----------
sync from github: prepare for version 4.8.4
Modified Paths:
--------------
trunk/fb-contrib/build.xml
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/FCBL_Sample.java
trunk/fb-contrib/samples/samples.fbp
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseSplit.java
Added Paths:
-----------
trunk/fb-contrib/samples/AIOB_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/build.xml 2013-07-14 19:23:07 UTC (rev 1748)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.9.0" />
+ <property name="fb-contrib.version" value="4.8.4" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -182,6 +182,7 @@
<attribute name="Bundle-Vendor" value="FB-Contrib Project" />
<attribute name="Require-Bundle" value="edu.umd.cs.findbugs.plugin.eclipse" />
<attribute name="Bundle-ActivationPolicy" value="lazy" />
+ <attribute name="Export-Package" value="com.mebigfatguy.fbcontrib.collect, com.mebigfatguy.fbcontrib.detect" />
</manifest>
</jar>
</target>
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-07-14 19:23:07 UTC (rev 1748)
@@ -30,9 +30,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +73,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -176,9 +176,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +193,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +221,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE -->
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
-<!-- COMMENT OUT FOR RELEASE -->
+ COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
@@ -235,7 +235,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers" speed="fast" reports="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_MISMATCHED_RETURN,CU_CLONE_USABILITY_THROWS" />
-
+<!-- COMMENT OUT FOR RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
@@ -244,6 +244,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.NonProductiveMethodCall" speed="fast" reports="NPMC_NON_PRODUCTIVE_METHOD_CALL" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayIndexOutOfBounds" speed="fast" reports="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS,AIOB_ARRAY_STORE_TO_NULL_REFERENCE" />
+-->
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -430,4 +432,6 @@
<BugPattern abbrev="PSC" type="PSC_PRESIZE_COLLECTIONS" 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" />
+ <BugPattern abbrev="AIOB" type="AIOB_ARRAY_STORE_TO_NULL_REFERENCE" category="CORRECTNESS" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/etc/messages.xml 2013-07-14 19:23:07 UTC (rev 1748)
@@ -40,7 +40,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators">
<Details>
<![CDATA[
- <p> Looks for use of iterators on synchronized collections built from the Collections class</p>
+ <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 thru Collections.synchronizedXXX, an assumption
is made that this collection must be multithreaded safe. However, iterator access is used,
which is explicitly unsafe. When iterators are to be used, synchronization should be done manually.</p>
@@ -319,7 +319,8 @@
<Details>
<![CDATA[
<p>Looks for methods that store the return result in a local variable and
- then immediately returns that local variable.</p>
+ then immediately returns that local variable. It is simpler to just return
+ the method (or assignment) result directly.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -350,7 +351,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.OrphanedDOMNode">
<Details>
<![CDATA[
- <p>Looks for methods that create DOM Nodes but do not add them to any DOM Document.</p>
+ <p>Looks for methods that create DOM nodes but do not add them to any DOM Document.</p>
<p>It is a fast Detector</p>
]]>
</Details>
@@ -1332,7 +1333,24 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayIndexOutOfBounds">
+ <Details>
+ <![CDATA[
+ <p>Looks for questionable load/stores to array elements.<ul>
+ <li>
+ Looks for accesses to array elements using literal values that are known to be outside the bounds of the array.
+ This mistake will cause an ArrayIndexOutOfBoundsException to occur at runtime.</li>
+ <li>
+ Looks for stores to array elements where the array itself appears to have not been allocated.
+ </li>
+ </ul>
+ </p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
<!-- BugPattern -->
<BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING">
@@ -3484,7 +3502,7 @@
<p>This method serializes an instance of a non-static inner class. Since this class has a
reference to the containing class, this outer class will be serialized as well. This is often
not intentional, and will make the amount of data that is serialized much more than is needed.
- If the outer classes is not desired to be serialized, either make the inner class, static, or
+ If the outer classes is not desired to be serialized, either make the inner class static, or
pull it out into a separate "first class" class.
]]>
</Details>
@@ -3593,7 +3611,7 @@
<LongDescription>Method {1} backport concurrency utils</LongDescription>
<Details>
<![CDATA[
- <p> This class usees Backport Utils concurrent classes. Updated/Efficient version of these
+ <p> This class uses Backport Utils concurrent classes. Updated/Efficient version of these
classes are available in versions of the JDK 5.0 and higher, and these
classes should only be used if you are targeting JDK 1.4 and lower.
</p>
@@ -3633,7 +3651,7 @@
<![CDATA[
<p> This class implements the Cloneable interface but defines its clone method to still return
a CloneNotSupportedException. Since you are implementing clone() it would make sense that the method
- in question will _not_ throw that exception, so annotating your method with it just makes client use
+ in question will <em>not</em> throw that exception, so annotating your method with it just makes client use
of your more painful as they have to handle an exception that will never happen. Just remove the
throws clause from your method.
</p>
@@ -3691,6 +3709,27 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS">
+ <ShortDescription>Method attempts to access an array element outside the array's size</ShortDescription>
+ <LongDescription>Method {1} attempts to access an array element outside the array's size</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method access an array element using a literal index that is know to be outside the size of the specified
+ array. This will cause an ArrayIndexOutOfBoundsException at runtime</p>
+ ]]>
+ </Details>
+ </BugPattern>
+
+ <BugPattern type="AIOB_ARRAY_STORE_TO_NULL_REFERENCE">
+ <ShortDescription>Method attempts to store an array element to an array that does not appear to be allocated</ShortDescription>
+ <LongDescription>Method {1} attempts to store an array element to an array that does not appear to be allocated</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method attempts to store an array element into an an array that appears to not have been allocated.
+ ]]>
+ </Details>
+ </BugPattern>
<!-- BugCode -->
@@ -3804,4 +3843,5 @@
<BugCode abbrev="PSC">Presize Collection</BugCode>
<BugCode abbrev="UMTP">Unbound Method Template Parameter</BugCode>
<BugCode abbrev="NPMC">Non Productive Method Call</BugCode>
+ <BugCode abbrev="AIOB">Array Index Out of Bounds</BugCode>
</MessageCollection>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/htdocs/index.shtml 2013-07-14 19:23:07 UTC (rev 1748)
@@ -107,6 +107,16 @@
is discarded. Since the method makes no changes to the object, calling this method
is useless. The method call can be removed.
</li>
+ <li><b>[AIOB] Array Index Out of Bounds</b><br/>
+ Looks for questionable load/stores to array elements.<ul>
+ <li>
+ Looks for accesses to array elements using literal values that are known to be outside the bounds of the array.
+ This mistake will cause an ArrayIndexOutOfBoundsException to occur at runtime.</li>
+ <li>
+ Looks for stores to array elements where the array itself appears to have not been allocated.
+ </li>
+ </ul>
+ </li>
</ul>
</div>
<hr/>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/pom.xml 2013-07-14 19:23:07 UTC (rev 1748)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>4.9.0</version>
+ <version>4.8.4</version>
<parent>
<groupId>org.sonatype.oss</groupId>
Added: trunk/fb-contrib/samples/AIOB_Sample.java
===================================================================
--- trunk/fb-contrib/samples/AIOB_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/AIOB_Sample.java 2013-07-14 19:23:07 UTC (rev 1748)
@@ -0,0 +1,22 @@
+
+public class AIOB_Sample
+{
+ int[] fa = new int[4];
+ int[] fb;
+
+ public void testOutOfBounds()
+ {
+ int[] a = new int[4];
+
+ a[4] = 2;
+ fa[4] = 2;
+ }
+
+ public void testUnallocated()
+ {
+ int[] b = null;
+
+ b[4] = 4;
+ fb[4] = 4;
+ }
+}
Property changes on: trunk/fb-contrib/samples/AIOB_Sample.java
___________________________________________________________________
Added: svn:eol
## -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
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/fb-contrib/samples/FCBL_Sample.java
===================================================================
--- trunk/fb-contrib/samples/FCBL_Sample.java 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/samples/FCBL_Sample.java 2013-07-14 19:23:07 UTC (rev 1748)
@@ -7,6 +7,7 @@
protected int boo;
int hoo;
private int fp;
+ private int multiMethodFP;
private String test;
private int x = 1;
private int y = 2;
@@ -57,4 +58,17 @@
test = "woowoo";
}
+
+ public void mm1FP(int i) {
+ multiMethodFP = i;
+ mm2FP(3);
+
+ if (multiMethodFP == i) {
+ System.out.println("FP");
+ }
+ }
+
+ public void mm2FP(int i) {
+ multiMethodFP = i;
+ }
}
Modified: trunk/fb-contrib/samples/samples.fbp
===================================================================
--- trunk/fb-contrib/samples/samples.fbp 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/samples/samples.fbp 2013-07-14 19:23:07 UTC (rev 1748)
@@ -1,10 +1,12 @@
<Project projectName="sample">
- <Jar>.</Jar>
- <AuxClasspathEntry>./lib/jsp-api-2.2.1.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./lib/junit-4.10.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./lib/log4j-1.2.16.jar</AuxClasspathEntry>
- <AuxClasspathEntry>./lib/servlet-api-3.0.1.jar</AuxClasspathEntry>
- <SrcDir>.</SrcDir>
+ <Jar>./.</Jar>
+ <AuxClasspathEntry>././lib/jsp-api-2.2.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././lib/junit-4.10.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././lib/log4j-1.2.16.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>././lib/servlet-api-3.0.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./lib/commons-lang3-3.1.jar</AuxClasspathEntry>
+ <AuxClasspathEntry>./lib/backport-util-concurrent-3.1.jar</AuxClasspathEntry>
+ <SrcDir>./.</SrcDir>
<SuppressionFilter>
<LastVersion value="-1" relOp="NEQ"/>
</SuppressionFilter>
Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java (rev 0)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java 2013-07-14 19:23:07 UTC (rev 1748)
@@ -0,0 +1,197 @@
+/*
+ * fb-contrib - Auxiliary detectors for Java programs
+ * Copyright (C) 2005-2013 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package com.mebigfatguy.fbcontrib.detect;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.bcel.Constants;
+import org.apache.bcel.classfile.Code;
+import org.apache.bcel.classfile.Constant;
+import org.apache.bcel.classfile.ConstantInteger;
+import org.apache.bcel.classfile.Method;
+import org.apache.bcel.generic.Type;
+
+import edu.umd.cs.findbugs.BugInstance;
+import edu.umd.cs.findbugs.BugReporter;
+import edu.umd.cs.findbugs.BytecodeScanningDetector;
+import edu.umd.cs.findbugs.OpcodeStack;
+import edu.umd.cs.findbugs.ba.ClassContext;
+
+public class ArrayIndexOutOfBounds extends BytecodeScanningDetector {
+
+ private BugReporter bugReporter;
+ private OpcodeStack stack;
+ private Set<Integer> initializedRegs;
+
+ /**
+ * constructs an AIOB detector given the reporter to report bugs on
+
+ * @param bugReporter the sync of bug reports
+ */
+ public ArrayIndexOutOfBounds(BugReporter bugReporter) {
+ this.bugReporter = bugReporter;
+ }
+
+ public void visitClassContext(ClassContext classContext) {
+ try {
+ stack = new OpcodeStack();
+ initializedRegs = new HashSet<Integer>();
+ super.visitClassContext(classContext);
+ } finally {
+ stack = null;
+ initializedRegs = null;
+ }
+ }
+
+ public void visitCode(Code obj) {
+ Method m = getMethod();
+ stack.resetForMethodEntry(this);
+ initializedRegs.clear();
+ Type[] argTypes = m.getArgumentTypes();
+ int arg = ((m.getAccessFlags() & Constants.ACC_STATIC) != 0) ? 0 : 1;
+ for (Type argType : argTypes) {
+ String argSig = argType.getSignature();
+ initializedRegs.add(Integer.valueOf(arg));
+ arg += ("J".equals(argSig) || "D".equals(argSig)) ? 2 : 1;
+ }
+ super.visitCode(obj);
+
+ initializedRegs.clear();
+ }
+
+ public void sawOpcode(int seen) {
+ Integer size = null;
+ try {
+ switch (seen) {
+ case ICONST_0:
+ case ICONST_1:
+ case ICONST_2:
+ case ICONST_3:
+ case ICONST_4:
+ case ICONST_5:
+ size = Integer.valueOf(seen - ICONST_0);
+ break;
+
+ case BIPUSH:
+ case SIPUSH:
+ size = getIntConstant();
+ break;
+
+ case LDC:
+ Constant c = getConstantRefOperand();
+ if (c instanceof ConstantInteger) {
+ size = Integer.valueOf(((ConstantInteger) c).getBytes());
+ }
+ break;
+
+ case NEWARRAY:
+ case ANEWARRAY:
+ if (stack.getStackDepth() >= 1) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ size = (Integer) item.getUserValue();
+ }
+ break;
+
+ case IASTORE:
+ case LASTORE:
+ case FASTORE:
+ case DASTORE:
+ case AASTORE:
+ case BASTORE:
+ case CASTORE:
+ case SASTORE:
+ if (stack.getStackDepth() >= 3) {
+ OpcodeStack.Item indexItem = stack.getStackItem(1);
+ Integer index = (Integer) indexItem.getConstant();
+ if (index != null) {
+ OpcodeStack.Item arrayItem = stack.getStackItem(2);
+ Integer sz = (Integer) arrayItem.getUserValue();
+ if (sz != null) {
+ if (index.intValue() >= sz.intValue()) {
+ bugReporter.reportBug(new BugInstance(this, "AIOB_ARRAY_INDEX_OUT_OF_BOUNDS", HIGH_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
+ }
+
+ int reg = arrayItem.getRegisterNumber();
+ if ((reg >= 0) && !initializedRegs.contains(Integer.valueOf(reg))) {
+ bugReporter.reportBug(new BugInstance(this, "AIOB_ARRAY_STORE_TO_NULL_REFERENCE", HIGH_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
+ }
+ }
+ break;
+
+ case IALOAD:
+ case LALOAD:
+ case FALOAD:
+ case DALOAD:
+ case AALOAD:
+ case BALOAD:
+ case CALOAD:
+ case SALOAD:
+ if (stack.getStackDepth() >= 2) {
+ OpcodeStack.Item indexItem = stack.getStackItem(0);
+ Integer index = (Integer) indexItem.getConstant();
+ if (index != null) {
+ OpcodeStack.Item arrayItem = stack.getStackItem(1);
+ Integer sz = (Integer) arrayItem.getUserValue();
+ if (sz != null) {
+ if (index.intValue() >= sz.intValue()) {
+ bugReporter.reportBug(new BugInstance(this, "AIOB_ARRAY_INDEX_OUT_OF_BOUNDS", HIGH_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this));
+ }
+ }
+ }
+ }
+ break;
+
+ case ASTORE_0:
+ case ASTORE_1:
+ case ASTORE_2:
+ case ASTORE_3:
+ case ASTORE:
+ if (stack.getStackDepth() > 0) {
+ OpcodeStack.Item value = stack.getStackItem(0);
+ if (!value.isNull())
+ initializedRegs.add(Integer.valueOf(getRegisterOperand()));
+ } else {
+ initializedRegs.add(Integer.valueOf(getRegisterOperand()));
+ }
+ break;
+ }
+
+ } finally {
+ stack.sawOpcode(this, seen);
+ if (size != null) {
+ if (stack.getStackDepth() >= 1) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ item.setUserValue(size);
+ }
+ }
+ }
+ }
+}
Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
___________________________________________________________________
Added: svn:eol
## -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
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2013-07-14 19:23:07 UTC (rev 1748)
@@ -54,6 +54,7 @@
dangerousAssignmentClassSources.add("java/io/InputStream");
dangerousAssignmentClassSources.add("java/io/ObjectInput");
dangerousAssignmentMethodSources.add("java/lang/System.currentTimeMillis()J");
+ dangerousAssignmentMethodSources.add("java/lang/System.nanoTime()J");
dangerousAssignmentMethodSources.add("java/util/Iterator.next()Ljava/lang/Object;");
dangerousAssignmentMethodSources.add("java/util/regex/Matcher.start()I");
}
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java 2013-07-14 19:23:07 UTC (rev 1748)
@@ -117,9 +117,11 @@
si = stack.getStackItem(0);
signature = si.getSignature();
if (isToStringBuilder(signature)) {
- Pair p = stackTracker.pop();
- registerTracker.put(Integer.valueOf(p.register),
- Boolean.valueOf(p.appendInvoked));
+ if (!stackTracker.isEmpty()) {
+ Pair p = stackTracker.pop();
+ registerTracker.put(Integer.valueOf(p.register),
+ Boolean.valueOf(p.appendInvoked));
+ }
}
break;
case INVOKESPECIAL:
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2013-06-01 19:30:46 UTC (rev 1747)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2013-07-14 19:23:07 UTC (rev 1748)
@@ -82,13 +82,14 @@
}
private static final Map<String, Integer> modifyingMethods = new HashMap<String, Integer>();
static {
- modifyingMethods.put("add(Ljava/lang/Object;)Z", Integer.valueOf(1));
- modifyingMethods.put("addAll(Ljava/util/Collection;)Z", Integer.valueOf(1));
+ Integer ONE = Integer.valueOf(1);
+ modifyingMethods.put("add(Ljava/lang/Object;)Z", ONE);
+ modifyingMethods.put("addAll(Ljava/util/Collection;)Z", ONE);
modifyingMethods.put("addAll(ILjava/util/Collection;)Z", Integer.valueOf(2));
modifyingMethods.put("clear()V", Integer.valueOf(0));
- modifyingMethods.put("remove(I)Ljava/lang/Object;", Integer.valueOf(1));
- modifyingMethods.put("removeAll(Ljava/util/Collection;)Z", Integer.valueOf(1));
- modifyingMethods.put("retainAll(Ljava/util/Collection;)Z", Integer.valueOf(1));
+ modifyingMethods.put("remove(I)Ljava/lang/Object;", ONE);
+ modifyingMethods.put("removeAll(Ljava/util/Collection;)Z", ONE);
+ modifyingMethods.put("retainAll(Ljava/util/Collection;)Z", ONE);
}
private BugReporter bugReporter;
Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/...
[truncated message content] |
|
From: <dbr...@us...> - 2013-10-19 23:44:11
|
Revision: 1751
http://sourceforge.net/p/fb-contrib/code/1751
Author: dbrosius
Date: 2013-10-19 23:44:05 +0000 (Sat, 19 Oct 2013)
Log Message:
-----------
version 4.8.5
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/bcel.license
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/samples/AIOB_Sample.java
trunk/fb-contrib/samples/BAS_Sample.java
trunk/fb-contrib/samples/BED_Sample.java
trunk/fb-contrib/samples/CLI_Sample.java
trunk/fb-contrib/samples/FP_Sample.java
trunk/fb-contrib/samples/LO_Sample.java
trunk/fb-contrib/samples/PCAIL_Sample.java
trunk/fb-contrib/samples/PMB_Sample.java
trunk/fb-contrib/samples/PSC_Sample.java
trunk/fb-contrib/samples/SPP_Sample.java
trunk/fb-contrib/samples/SUA_Sample.java
trunk/fb-contrib/samples/WOC_Sample.java
trunk/fb-contrib/samples/samples.fbp
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
Added Paths:
-----------
trunk/fb-contrib/samples/SCRV_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/.classpath 2013-10-19 23:44:05 UTC (rev 1751)
@@ -4,14 +4,15 @@
<classpathentry kind="src" path="src"/>
<classpathentry excluding="lib/" kind="src" path="samples"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="samples/lib/jsp-api-2.2.1.jar"/>
- <classpathentry kind="lib" path="samples/lib/junit-4.10.jar"/>
+ <classpathentry kind="lib" path="samples/lib/junit-4.10.jar" sourcepath="/home/dave/.m2/repository/junit/junit/4.10/junit-4.10-sources.jar"/>
<classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/>
<classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/>
<classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
<classpathentry kind="lib" path="samples/lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="lib" path="samples/lib/backport-util-concurrent-3.1.jar"/>
+ <classpathentry kind="lib" path="samples/lib/slf4j-api-1.7.5.jar"/>
+ <classpathentry kind="lib" path="samples/lib/junit.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/build.xml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.8.4" />
+ <property name="fb-contrib.version" value="4.8.5" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -40,6 +40,7 @@
<property name="servlet-api.version" value="3.0.1" />
<property name="backport-util-concurrent.version" value="3.1" />
<property name="commons-collections.version" value="3.2.1" />
+ <property name="slf4j.version" value="1.7.5" />
<property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar" />
<property name="jsp-api-url" value="http://repo1.maven.org/maven2/javax/servlet/jsp/javax.servlet.jsp-api/${jsp-api.version}/javax.servlet.jsp-api-${jsp-api.version}.jar" />
@@ -48,6 +49,7 @@
<property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar" />
<property name="backport-util-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-util-concurrent.version}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
<property name="commons-collections-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" />
+ <property name="slf4j-api-url" value="http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.jar" />
<target name="check">
<available file="${dest}/${name}-${version}.jar" property="jar-exists" />
@@ -85,6 +87,7 @@
<pull url="${servlet-api-url}" dest="${sampleslib.dir}" name="servlet-api" version="${servlet-api.version}" />
<pull url="${backport-util-concurrent-url}" dest="${sampleslib.dir}" name="backport-util-concurrent" version="${backport-util-concurrent.version}" />
<pull url="${commons-collections-url}" dest="${sampleslib.dir}" name="commons-collections" version="${commons-collections.version}" />
+ <pull url="${slf4j-api-url}" dest="${sampleslib.dir}" name="slf4j-api" version="${slf4j.version}" />
</target>
<target name="clean" description="removes all generated collateral">
@@ -119,7 +122,8 @@
<pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar" />
<pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
<pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
- <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
+ <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
+ <pathelement location="${sampleslib.dir}/slf4j-api-${slf4j.version}.jar" />
</path>
<mkdir dir="${classes.dir}/com" />
<mkdir dir="${classes.dir}/com/mebigfatguy" />
@@ -182,7 +186,7 @@
<attribute name="Bundle-Vendor" value="FB-Contrib Project" />
<attribute name="Require-Bundle" value="edu.umd.cs.findbugs.plugin.eclipse" />
<attribute name="Bundle-ActivationPolicy" value="lazy" />
- <attribute name="Export-Package" value="com.mebigfatguy.fbcontrib.collect, com.mebigfatguy.fbcontrib.detect" />
+ <attribute name="Export-Package" value="com.mebigfatguy.fbcontrib.collect, com.mebigfatguy.fbcontrib.detect, com.mebigfatguy.fbcontrib.debug" />
</manifest>
</jar>
</target>
Modified: trunk/fb-contrib/etc/bcel.license
===================================================================
--- trunk/fb-contrib/etc/bcel.license 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/etc/bcel.license 2013-10-19 23:44:05 UTC (rev 1751)
@@ -187,7 +187,7 @@
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
- * Copyright [yyyy] [name of copyright owner]
+ * Copyright [2013] [Aoache BCEL]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -16,7 +16,25 @@
<!-- Detectors -->
<Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" speed="fast" reports="" hidden="true" />
+
+<!-- PERMANENTLY DISABLED
+ <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger" speed="fast"/>
+-->
+<!-- COMMENT OUT FOR RELEASE -->
+
+ <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.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
+
+<!-- COMMENT OUT FOR RELEASE -->
+
<Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering" speed="fast" reports="ISB_INEFFICIENT_STRING_BUFFERING,ISB_EMPTY_STRING_APPENDING,ISB_TOSTRING_APPENDING" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators" speed="slow" reports="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" />
@@ -30,9 +48,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" />
-<!-- COMMENT OUT FOR RELEASE
- <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" />
- COMMENT OUT FOR RELEASE -->
+
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" />
@@ -73,9 +89,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" />
-<!-- COMMENT OUT FOR RELEASE
- <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+
<Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" />
@@ -132,10 +146,10 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast"
- reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_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_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS" />
-<!-- COMMENT OUT FOR RELEASE
+ 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_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF" />
+
<Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
- COMMENT OUT FOR RELEASE -->
+
<Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeletingWhileIterating" speed="fast" reports="DWI_DELETING_WHILE_ITERATING,DWI_MODIFYING_WHILE_ITERATING" />
@@ -165,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" />
+ <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" />
<Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" />
@@ -176,9 +190,6 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" />
-<!-- COMMENT OUT FOR RELEASE
- <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" />
- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" />
@@ -193,9 +204,6 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" />
<Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" />
-<!-- COMMENT OUT FOR RELEASE
- <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" />
- COMMENT OUT FOR RELEASE -->
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
@@ -221,9 +229,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" />
-<!-- COMMENT OUT FOR RELEASE
- <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" />
- COMMENT OUT FOR RELEASE -->
+
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" />
@@ -235,7 +241,9 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers" speed="fast" reports="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_MISMATCHED_RETURN,CU_CLONE_USABILITY_THROWS" />
-<!-- COMMENT OUT FOR RELEASE
+
+<!-- For 5.0.0
+
<Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" />
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
@@ -245,6 +253,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.NonProductiveMethodCall" speed="fast" reports="NPMC_NON_PRODUCTIVE_METHOD_CALL" />
<Detector class="com.mebigfatguy.fbcontrib.detect.ArrayIndexOutOfBounds" speed="fast" reports="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS,AIOB_ARRAY_STORE_TO_NULL_REFERENCE" />
+
-->
<!-- BugPattern -->
@@ -347,6 +356,7 @@
<BugPattern abbrev="SPP" type="SPP_STRINGBUILDER_IS_MUTABLE" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_USE_GET0" category="PERFORMANCE" />
<BugPattern abbrev="SPP" type="SPP_DOUBLE_APPENDED_LITERALS" category="PERFORMANCE" />
+ <BugPattern abbrev="SPP" type="SPP_NULL_BEFORE_INSTANCEOF" 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" />
@@ -370,10 +380,12 @@
<BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" category="CORRECTNESS" />
<BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" />
<BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" />
- <BugPattern abbrev="LO" type="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE" category="CORRECTNESS" />
+ <BugPattern abbrev="LO" type="LO_LOGGER_LOST_EXCEPTION_STACK_TRACE" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_SUSPECT_LOG_PARAMETER" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_STUTTERED_MESSAGE" category="STYLE" />
+ <BugPattern abbrev="LO" type="LO_INVALID_FORMATTING_ANCHOR" category="CORRECTNESS" />
+ <BugPattern abbrev="LO" type="LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS" 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" />
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/etc/messages.xml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -62,8 +62,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.OverlyConcreteParameter">
<Details>
<![CDATA[
- <p> Looks for parameters that are defined by classes, but only use methods defined by an
- implemented interface or super class. Relying on concrete classes in public signatures causes cohesion,
+ <p> Looks for parameters that are defined by classes, but where the method only use methods defined by an
+ implemented interface or super class 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>
]]>
@@ -1350,6 +1350,9 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger">
+ <Details></Details>
+ </Detector>
<!-- BugPattern -->
@@ -1601,11 +1604,11 @@
</BugPattern>
<BugPattern type="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN">
- <ShortDescription>Class has abnormal exit from finally block</ShortDescription>
- <LongDescription>Class {0} has abnormal exit from finally block</LongDescription>
+ <ShortDescription>Method has abnormal exit from finally block</ShortDescription>
+ <LongDescription>Method {1} has abnormal exit from finally block</LongDescription>
<Details>
<![CDATA[
- <p>This class returns or throws exceptions from a finally block. This will
+ <p>This method returns or throws exceptions from a finally block. This will
mask real program logic in the try block, and short-circuit normal method termination.
</p>
]]>
@@ -2646,6 +2649,17 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="SPP_NULL_BEFORE_INSTANCEOF">
+ <ShortDescription>Method checks a reference for null before calling instanceof</ShortDescription>
+ <LongDescription>Method {1} checks a reference for null before calling instanceof</LongDescription>
+ <Details>
+ <![CDATA[
+ This method checks a reference for null just before seeing if the reference is an instanceof some class.
+ Since instanceof will return false for null references, the null check is not needed.
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE">
<ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription>
@@ -2994,6 +3008,29 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="LO_INVALID_FORMATTING_ANCHOR">
+ <ShortDescription>Method attempts to log using numbered formatting anchors</ShortDescription>
+ <LongDescription>Method {1} attempts to log using numbered formatting anchors</LongDescription>
+ <Details>
+ <![CDATA[
+ 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
+ code uses. Thus no parameter replacement will occur.
+ ]]>
+ </Details>
+ </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>
+ <Details>
+ <![CDATA[
+ This method passes the wrong number of parameters to a slf4j logging method (error, warn, info, debug) based on the number of anchors {} in the
+ format string. An additional exception argument is allowed if found.
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="IICU_INCORRECT_INTERNAL_CLASS_USE">
<ShortDescription>Class relies on internal api classes</ShortDescription>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/htdocs/index.shtml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -68,8 +68,8 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.2 available for download
- <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.2.jar/download">here</a>.</p>
+ <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.5 available for download
+ <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.5.jar/download">here</a>.</p>
</div>
<hr/>
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/htdocs/repository.html 2013-10-19 23:44:05 UTC (rev 1751)
@@ -22,11 +22,11 @@
<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>4.8.2</td></tr>
+ <tr><td><b>Version:</b></td><td>4.8.5</td></tr>
</table>
</div>
-<p>fb-contrib is also now available at <a href="http://search.maven.org">search.maven.org</a></p>
+<p>fb-contrib is also now available at <a href="http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.mebigfatguy.fb-contrib%22">search.maven.org</a></p>
</div>
</body>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/pom.xml 2013-10-19 23:44:05 UTC (rev 1751)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>4.8.4</version>
+ <version>4.8.5</version>
<parent>
<groupId>org.sonatype.oss</groupId>
@@ -44,6 +44,15 @@
</properties>
<timezone>+1</timezone>
</contributor>
+ <contributor>
+ <name>Trevor Pounds</name>
+ </contributor>
+ <contributor>
+ <name>Ronald Blaschke</name>
+ </contributor>
+ <contributor>
+ <name>Zenichi Amano</name>
+ </contributor>
</contributors>
<licenses>
Modified: trunk/fb-contrib/samples/AIOB_Sample.java
===================================================================
--- trunk/fb-contrib/samples/AIOB_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/AIOB_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -1,4 +1,6 @@
+import java.util.List;
+
public class AIOB_Sample
{
int[] fa = new int[4];
@@ -19,4 +21,17 @@
b[4] = 4;
fb[4] = 4;
}
+
+ public int[] fpPlusPlusNotRecognized(List<String> l) {
+ int size = 0;
+
+ for (String s : l) {
+ size++;
+ }
+
+ int[] data = new int[size];
+
+ data[0] = 0;
+ return data;
+ }
}
Modified: trunk/fb-contrib/samples/BAS_Sample.java
===================================================================
--- trunk/fb-contrib/samples/BAS_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/BAS_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -1,3 +1,4 @@
+import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashMap;
@@ -166,6 +167,18 @@
}
return it.next();
-
}
+
+ public List<String> testFPSynchronized(String s, String p) {
+ List<String> l = new ArrayList<String>();
+ String x = s;
+ synchronized(s) {
+ if (p != null) {
+ l.add(p);
+ return l;
+ }
+ }
+
+ return null;
+ }
}
Modified: trunk/fb-contrib/samples/BED_Sample.java
===================================================================
--- trunk/fb-contrib/samples/BED_Sample.java 2013-07-14 19:44:11 UTC (rev 1750)
+++ trunk/fb-contrib/samples/BED_Sample.java 2013-10-19 23:44:05 UTC (rev 1751)
@@ -37,6 +37,1...
[truncated message content] |
|
From: <dbr...@us...> - 2013-11-17 21:48:08
|
Revision: 1755
http://sourceforge.net/p/fb-contrib/code/1755
Author: dbrosius
Date: 2013-11-17 21:48:02 +0000 (Sun, 17 Nov 2013)
Log Message:
-----------
prepare for the 5.0.0 release
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
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/samples/AIOB_Sample.java
trunk/fb-contrib/samples/JAO_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TailRecursion.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseSplit.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
Added Paths:
-----------
trunk/fb-contrib/samples/ICA_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InvalidConstantArgument.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2013-10-20 02:34:16 UTC (rev 1754)
+++ trunk/fb-contrib/.classpath 2013-11-17 21:48:02 UTC (rev 1755)
@@ -11,7 +11,7 @@
<classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
<classpathentry kind="lib" path="samples/lib/commons-collections-3.2.1.jar"/>
- <classpathentry kind="lib" path="samples/lib/backport-util-concurrent-3.1.jar"/>
+ <classpathentry kind="lib" path="samples/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="samples/lib/slf4j-api-1.7.5.jar"/>
<classpathentry kind="lib" path="samples/lib/junit.jar"/>
<classpathentry kind="output" path="classes"/>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-10-20 02:34:16 UTC (rev 1754)
+++ trunk/fb-contrib/build.xml 2013-11-17 21:48:02 UTC (rev 1755)
@@ -17,7 +17,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="4.8.5" />
+ <property name="fb-contrib.version" value="5.0.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 2013-10-20 02:34:16 UTC (rev 1754)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-11-17 21:48:02 UTC (rev 1755)
@@ -130,6 +130,8 @@
<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_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" />
+
<Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" />
<Detector class="com.mebigfatguy.fbcontrib.detect.DeletingWhileIterating" speed="fast" reports="DWI_DELETING_WHILE_ITERATING,DWI_MODIFYING_WHILE_ITERATING" />
@@ -222,7 +224,14 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_MISMATCHED_RETURN,CU_CLONE_USABILITY_THROWS" />
-
+ <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.UnboundMethodTemplateParameter" speed="fast" reports="UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.NonProductiveMethodCall" speed="fast" reports="NPMC_NON_PRODUCTIVE_METHOD_CALL" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.InvalidConstantArgument" speed="fast" reports="ICA_INVALID_CONSTANT_ARRAY" />
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -414,4 +423,5 @@
<BugPattern abbrev="NPMC" type="NPMC_NON_PRODUCTIVE_METHOD_CALL" category="CORRECTNESS" />
<BugPattern abbrev="AIOB" type="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS" category="CORRECTNESS" />
<BugPattern abbrev="AIOB" type="AIOB_ARRAY_STORE_TO_NULL_REFERENCE" category="CORRECTNESS" />
+ <BugPattern abbrev="ICA" type="ICA_INVALID_CONSTANT_ARGUMENT" category="CORRECTNESS" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-10-20 02:34:16 UTC (rev 1754)
+++ trunk/fb-contrib/etc/messages.xml 2013-11-17 21:48:02 UTC (rev 1755)
@@ -40,8 +40,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators">
<Details>
<![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 thru Collections.synchronizedXXX, an assumption
+ <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,
which is explicitly unsafe. When iterators are to be used, synchronization should be done manually.</p>
<p>It is a slow detector</p>
@@ -84,10 +84,10 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents">
<Details>
<![CDATA[
- <p> Looks for collections or arrays that hold objects that are unrelated thru class or
+ <p> Looks for collections or arrays that hold objects that are unrelated through class or
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 seperate class,
+ 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
collection, or array.</p>
<p>It is a fast detector</p>
@@ -111,7 +111,7 @@
<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 it's own
+ <p> Looks for methods that use a high percentage of methods from another class over its 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>
@@ -145,7 +145,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.DubiousListCollection">
<Details>
<![CDATA[
- <p> looks for fields that are implementations of java.util.List, but that are used in a set-like fashion.
+ <p> Looks for fields that are implementations of java.util.List, but that are used in a set-like fashion.
Since lookup type operations are performed using a linear search for Lists, the performance for large
Lists will be poor. Consideration should be made as to whether these fields should be sets. In the
case that order is important, consider using LinkedHashSet.</p>
@@ -170,7 +170,7 @@
<Details>
<![CDATA[
<p>Looks for methods that correctly do not write to a parameter. To help document this, and to perhaps
- help the jvm optimize the invocation of this method, you should consider defining these parameters
+ help the JVM optimize the invocation of this method, you should consider defining these parameters
as final.</p>
<p>It is a slow detector</p>
]]>
@@ -247,7 +247,7 @@
<pre>
public void test(Character c)
</pre>
- but instead maps to one that takes an int long, float or double.
+ but instead maps to one that takes an int, long, float or double.
</p>
<p>It is a fast detector</p>
]]>
@@ -285,7 +285,7 @@
java.lang.Thread. Since the internal workings of the threads is to synchronize on the
thread itself, introducing client calls will confuse the thread state of the object
in question, and will cause spurious thread state changes, either waking threads up
- when not intended, or removing the the thread from the runnable state.</p>
+ when not intended, or removing the thread from the runnable state.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -308,7 +308,7 @@
</ul>
</p>
<p>It also looks for calls to BoxedClass.valueOf(x) where X is already a Boxed class</p>
- <p>It also looks for calls to BoxedClass.valueOf(myString).boxedValue(), When instead it is
+ <p>It also looks for calls to BoxedClass.valueOf(myString).boxedValue(), when instead it is
simpler to use BoxedClass.parseBoxed(myString)</p>
<p>It is a fast detector</p>
]]>
@@ -319,7 +319,7 @@
<Details>
<![CDATA[
<p>Looks for methods that store the return result in a local variable and
- then immediately returns that local variable. It is simpler to just return
+ then immediately return that local variable. It is simpler to just return
the method (or assignment) result directly.</p>
<p>It is a fast detector</p>
]]>
@@ -329,7 +329,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod">
<Details>
<![CDATA[
- <p>Looks for methods that are direct copies of the implementation in the super class</p>
+ <p>Looks for methods that are direct copies of the implementation in the super class.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -371,9 +371,9 @@
<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 concatenation 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
+ modify, validate and understand. It is cleaner to create external XML files that are
transformed at runtime, using parameters set through Transformer.setParameter.
<p>It is a fast detector</p>
]]>
@@ -395,7 +395,7 @@
<Details>
<![CDATA[
<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 intented to be a loop
+ 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.</p>
<p>It is a fast detector</p>
@@ -430,8 +430,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SluggishGui">
<Details>
<![CDATA[
- <p>Looks for methods that implement awt or swing listeners and perform time
- consuming operations. Doing these operations in the gui thread will cause the
+ <p>Looks for methods that implement AWT or Swing listeners and perform time
+ consuming operations. Doing these operations in the GUI thread will cause the
interface to appear sluggish and non-responsive to the user. It is better to
use a separate thread to do the time consuming work so that the user
has a better experience.</p>
@@ -473,7 +473,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.JDBCVendorReliance">
<Details>
<![CDATA[
- <p>Looks for uses of jdbc vendor specific classes and methods making the database
+ <p>Looks for uses of JDBC vendor specific classes and methods making the database
access code non portable.</p>
<p>It is a fast detector</p>
]]>
@@ -550,7 +550,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UseEnumCollections">
<Details>
<![CDATA[
- <p>Looks for use of sets and maps using enums. It is more efficient to use EnumSet or EnumMap</p>
+ <p>Looks for use of sets and maps using enums. It is more efficient to use EnumSet or EnumMap.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -559,7 +559,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SQLInLoop">
<Details>
<![CDATA[
- <p>Looks for the execution of sql queries inside a loop. This pattern tends to be inefficient,
+ <p>Looks for the execution of SQL queries inside a loop. This pattern tends to be inefficient,
and often can be improved upon, by collecting all the keys needed for the query and issuing just
one query using an in clause with all the keys for all the queries previously needed in the loop.</p>
<p>It is a fast detector</p>
@@ -594,7 +594,7 @@
<![CDATA[
<p>Looks for creation of arrays in methods using constant values. These arrays
will need to be recreated each time the method is called. These arrays should probably
- be defined as static fields, instead</p>
+ be defined as static fields, instead.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -659,7 +659,7 @@
<![CDATA[
<p>Looks for methods that are defined to return Object, and return different types of
objects based on different code paths. If this method is not based on a interface or
- superclass, it is suggested to change the return type to a type that would accomodate
+ superclass, it is suggested to change the return type to a type that would accommodate
all kinds of return types.</p>
<p>It is a fast detector.</p>
]]>
@@ -701,7 +701,7 @@
<Details>
<![CDATA[
<p><em>THIS DETECTOR IS HIGHLY EXPERIMENTAL AND IS LIKELY TO CREATE A LOT OF FUD</em>
- Looks for assignments to variables in a scope larger than it's use. As long as the evaluation of the assignment
+ Looks for assignments to variables in a scope larger than its 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>
]]>
@@ -747,7 +747,7 @@
<![CDATA[
<p>Looks for calls to classes and methods that do not exist in the JDK for which this class is
compiled. This can happen if you specify the -source and -target options of the javac compiler, and
- specify a target that is less than the jdk version of the javac compiler.</p>
+ specify a target that is less than the JDK version of the javac compiler.</p>
<p>It is a slow detector.</p>
]]>
</Details>
@@ -756,7 +756,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UseAddAll">
<Details>
<![CDATA[
- <p>Looks for loops that transfers the contents of one collection to another. These collection sources might
+ <p>Looks for loops that transfer the contents of one collection to another. These collection sources might
be local variables or member fields, including sets, maps key/values, lists, or arrays. It is simpler to
just use the addAll method of the collection class. In the case where the source is an array, you can use
Arrays.asList(array), and use that as the source to addAll.</p>
@@ -807,7 +807,7 @@
concerning are methods constrained by interface or super class contracts
not to throw checked exceptions but appear owned by the same author. Next
are methods constrained by interface or super class contracts and throw other
- types of checked exceptions. Most egregious are method not constrained by any interface
+ types of checked exceptions. Most egregious are methods not constrained by any interface
or superclass contract.</p>
<p>It is a moderately fast detector</p>
]]>
@@ -882,7 +882,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, SLF4j or commons logging.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -891,8 +891,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse">
<Details>
<![CDATA[
- <p>Looks for classes that rely on internal classes in the various apis or libraries. As these
- classes are not officially released from the api vendor, they are subject to change or removal, and thus,
+ <p>Looks for classes that rely on internal classes in the various APIs or libraries. As these
+ classes are not officially released from the API vendor, they are subject to change or removal, and thus,
should not be counted on.</p>
Packages that shouldn't be used are:
<ul>
@@ -913,10 +913,10 @@
on each item in the collection, this can be costly from a performance point of view.</p>
<p>In addition, using a set, or keySet of a map, infers that you will be looking for items based on
the value of a collection, which seems dubious at best.</p>
- <p>Finally, as collections are often modified, This may cause problems if the collection is modified,
+ <p>Finally, as collections are often modified, this may cause problems if the collection is modified,
thus changing hashCodes, etc, while the collection is in the set.</p>
<p>If you wish to keep a collection of collections, the outer collection should probably be a list
- to avoid these problems</p>
+ to avoid these problems.</p>
<p>It is a moderately fast detector</p>
]]>
</Details>
@@ -937,9 +937,9 @@
<Details>
<![CDATA[
<p>Looks for allocations of objects, and then immediately checking to see if the
- object is null, or non null. As the new operator is guaranteed to eiher succeed, or throw
+ object is null, or non null. As the new operator is guaranteed to either succeed, or throw
an exception, this null check is useless, and denotes a misunderstanding as to how
- the jvm works. You can remove this guard.</p>
+ the JVM works. You can remove this guard.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -949,8 +949,8 @@
<Details>
<![CDATA[
<p>Looks for classes that appear to implement the old style type safe enum pattern
- that was used before java added Enum support to the language. Since this class is
- compiled with java 1.5 or later, it would be simpler to just use java enums</p>
+ that was used before Java added Enum support to the language. Since this class is
+ compiled with Java 1.5 or later, it would be simpler to just use Java enums.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -984,7 +984,7 @@
<![CDATA[
<p>Looks for methods that return arrays that are allocated but not initialized
in this method. While it's possible that the calling method will do the work of
- initializing the array, it is not a usual pattern, and it suspected that this array
+ initializing the array, it is not a usual pattern, and it is suspected that this array
was just forgotten to be initialized.</p>
<p>It is a fast detector</p>
]]>
@@ -1051,7 +1051,7 @@
<Details>
<![CDATA[
<p>Finds contravariant array assignments. Since arrays are mutable data structures, their use
- must be restricted to covariant or invariant usage</p>
+ must be restricted to covariant or invariant usage.</p>
<pre>
class A {}
@@ -1083,7 +1083,7 @@
<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
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>
+ field or local variable is null, not, not null.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -1136,7 +1136,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.WriteOnlyCollection">
<Details>
<![CDATA[
- <p>This detector looks for allocations and initializations of java collections, but that are never
+ <p>This detector looks for allocations and initializations of Java collections, but that are never
read from or accessed to gain information. This represents a collection of no use, and most probably
can be removed. It is similar to a dead local store.</p>
<p>It is a fast detector</p>
@@ -1148,8 +1148,8 @@
<Details>
<![CDATA[
<p>This detector looks for definitions of methods that have an array as the last parameter.
- Since this class is compiled with java 1.5 or better, it would be more flexible for clients of this
- method to define this parameter as a vararg parameter</p>
+ Since this class is compiled with Java 1.5 or better, it would be more flexible for clients of this
+ method to define this parameter as a vararg parameter.</p>
<p>It is a fast detector</p>
]]>
</Details>
@@ -1181,7 +1181,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse">
<Details>
<![CDATA[
- <p>This detector looks for java bean getter-setter use where the value of a property is set
+ <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>
<pre>
person.setAge(person.getAge());
@@ -1250,7 +1250,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.CompareClassNameEquals">
<Details>
<![CDATA[
- <p> In a JVM, Two classes are the same class (and consequently the same type) if
+ <p> In a JVM, two classes are the same class (and consequently the same type) if
they are loaded by the same class loader, and they have the same fully
qualified name [JVMSpec 1999].
@@ -1350,6 +1350,19 @@
</Details>
</Detector>
+ <Detector class="com.mebigfatguy.fbcontrib.detect.InvalidConstantArgument">
+ <Details>
+ <![CDATA[
+ <p>Looks for method calls that take a parameter value that does not match one of the expected
+ values for that parameter. It is likely this parameter value should really be an enum, but predates
+ the addition of enums to java. Passing an invalid value will likely cause problems in the execution of
+ the method.
+ </p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger">
<Details></Details>
</Detector>
@@ -1434,8 +1447,8 @@
<LongDescription>Method {1} uses integer based for loops to iterate over a List</LongDescription>
<Details>
<![CDATA[
- <p>This method uses an integer based for loop to iterator over a java.util.List, by calling
- List.get(i) each time thru the loop. The integer is not used for other reasons. It is better
+ <p>This method uses an integer based for loop to iterate over a java.util.List, by calling
+ List.get(i) each time through the loop. The integer is not used for othe...
[truncated message content] |
|
From: <dbr...@us...> - 2013-12-11 03:20:31
|
Revision: 1758
http://sourceforge.net/p/fb-contrib/code/1758
Author: dbrosius
Date: 2013-12-11 03:20:25 +0000 (Wed, 11 Dec 2013)
Log Message:
-----------
prepare for the 5.0.1 release
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.properties
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/FCBL_Sample.java
trunk/fb-contrib/samples/JAO_Sample.java
trunk/fb-contrib/samples/LO_Sample.java
trunk/fb-contrib/samples/PRMC_Sample.java
trunk/fb-contrib/samples/samples.fbp
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InvalidConstantArgument.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
Added Paths:
-----------
trunk/fb-contrib/yank.xls
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2013-11-17 21:58:00 UTC (rev 1757)
+++ trunk/fb-contrib/.classpath 2013-12-11 03:20:25 UTC (rev 1758)
@@ -4,15 +4,18 @@
<classpathentry kind="src" path="src"/>
<classpathentry excluding="lib/" kind="src" path="samples"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="samples/lib/jsp-api-2.2.1.jar"/>
- <classpathentry kind="lib" path="samples/lib/junit-4.10.jar" sourcepath="/home/dave/.m2/repository/junit/junit/4.10/junit-4.10-sources.jar"/>
- <classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/>
- <classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/>
- <classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
- <classpathentry kind="lib" path="samples/lib/commons-collections-3.2.1.jar"/>
- <classpathentry kind="lib" path="samples/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="samples/lib/slf4j-api-1.7.5.jar"/>
- <classpathentry kind="lib" path="samples/lib/junit.jar"/>
+ <classpathentry kind="lib" path="lib/annotations-2.0.2.jar"/>
+ <classpathentry kind="lib" path="lib/asm-tree-3.3.1.jar"/>
+ <classpathentry kind="lib" path="lib/backport-util-concurrent-3.1.jar"/>
+ <classpathentry kind="lib" path="lib/bcel-2.0.2.jar"/>
+ <classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/>
+ <classpathentry kind="lib" path="lib/commons-lang3-3.1.jar"/>
+ <classpathentry kind="lib" path="lib/findbugs-2.0.2.jar"/>
+ <classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
+ <classpathentry kind="lib" path="lib/javax.servlet.jsp-api-2.2.1.jar"/>
+ <classpathentry kind="lib" path="lib/junit-4.11.jar"/>
+ <classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
+ <classpathentry kind="lib" path="lib/slf4j-api-1.7.5.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Modified: trunk/fb-contrib/build.properties
===================================================================
--- trunk/fb-contrib/build.properties 2013-11-17 21:58:00 UTC (rev 1757)
+++ trunk/fb-contrib/build.properties 2013-12-11 03:20:25 UTC (rev 1758)
@@ -7,3 +7,5 @@
etc/,\
samples/
output.. = classes/
+
+proxy.server =
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-11-17 21:58:00 UTC (rev 1757)
+++ trunk/fb-contrib/build.xml 2013-12-11 03:20:25 UTC (rev 1758)
@@ -1,15 +1,15 @@
<!-- fb-contrib Ant build script. Dave Brosius -->
-<project name="fb-contrib" default="install">
+<project name="fb-contrib" default="info">
- <property file="build.properties" />
+ <property file="build.properties" />
+ <property file="version.properties" />
<property name="src.dir" value="${basedir}/src" />
<property name="classes.dir" value="${basedir}/classes" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="etc.dir" value="${basedir}/etc" />
<property name="samples.dir" value="${basedir}/samples" />
- <property name="sampleslib.dir" value="${samples.dir}/lib" />
<property name="javadoc.dir" value="${basedir}/javadoc" />
<property name="htdocs.dir" value="${basedir}/htdocs" />
<property name="javac.source" value="1.5" />
@@ -17,79 +17,10 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="5.0.0" />
+ <property name="fb-contrib.version" value="5.0.1" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
-
- <property name="findbugs.version" value="2.0.1" />
- <property name="findbugs-bcel.version" value="2.0.1" />
- <property name="annotations.version" value="2.0.1" />
- <property name="asm-tree.version" value="3.3.1" />
-
- <property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar" />
- <property name="findbugs-bcel-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/bcel/${findbugs-bcel.version}/bcel-${findbugs-bcel.version}.jar" />
- <property name="annotations-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/annotations/${annotations.version}/annotations-${annotations.version}.jar" />
- <property name="asm-tree-url" value="http://repo1.maven.org/maven2/asm/asm-tree/${asm-tree.version}/asm-tree-${asm-tree.version}.jar" />
-
- <!-- properties for samples lib dependencies -->
- <property name="commons-lang3.version" value="3.1" />
- <property name="jsp-api.version" value="2.2.1" />
- <property name="junit.version" value="4.10" />
- <property name="log4j.version" value="1.2.16" />
- <property name="servlet-api.version" value="3.0.1" />
- <property name="backport-util-concurrent.version" value="3.1" />
- <property name="commons-collections.version" value="3.2.1" />
- <property name="slf4j.version" value="1.7.5" />
-
- <property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar" />
- <property name="jsp-api-url" value="http://repo1.maven.org/maven2/javax/servlet/jsp/javax.servlet.jsp-api/${jsp-api.version}/javax.servlet.jsp-api-${jsp-api.version}.jar" />
- <property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar" />
- <property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar" />
- <property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar" />
- <property name="backport-util-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-util-concurrent.version}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
- <property name="commons-collections-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" />
- <property name="slf4j-api-url" value="http://repo1.maven.org/maven2/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.jar" />
-
- <target name="check">
- <available file="${dest}/${name}-${version}.jar" property="jar-exists" />
- </target>
-
- <target name="_pull" depends="check" unless="jar-exists">
- <get src="${url}" dest="${dest}/${name}-${version}.jar" verbose="true" ignoreerrors="true" />
- </target>
-
- <macrodef name="pull">
- <attribute name="url" />
- <attribute name="dest" />
- <attribute name="name" />
- <attribute name="version" />
-
- <sequential>
- <antcall target="_pull">
- <param name="url" value="@{url}" />
- <param name="dest" value="@{dest}" />
- <param name="name" value="@{name}" />
- <param name="version" value="@{version}" />
- </antcall>
- </sequential>
- </macrodef>
-
- <target name="pullall">
- <pull url="${findbugs-url}" dest="${lib.dir}" name="findbugs" version="${findbugs.version}" />
- <pull url="${findbugs-bcel-url}" dest="${lib.dir}" name="findbugs-bcel" version="${findbugs-bcel.version}" />
- <pull url="${annotations-url}" dest="${lib.dir}" name="annotations" version="${annotations.version}" />
- <pull url="${asm-tree-url}" dest="${lib.dir}" name="asm-tree" version="${asm-tree.version}" />
- <pull url="${commons-lang3-url}" dest="${sampleslib.dir}" name="commons-lang3" version="${commons-lang3.version}" />
- <pull url="${jsp-api-url}" dest="${sampleslib.dir}" name="jsp-api" version="${jsp-api.version}" />
- <pull url="${junit-url}" dest="${sampleslib.dir}" name="junit" version="${junit.version}" />
- <pull url="${log4j-url}" dest="${sampleslib.dir}" name="log4j" version="${log4j.version}" />
- <pull url="${servlet-api-url}" dest="${sampleslib.dir}" name="servlet-api" version="${servlet-api.version}" />
- <pull url="${backport-util-concurrent-url}" dest="${sampleslib.dir}" name="backport-util-concurrent" version="${backport-util-concurrent.version}" />
- <pull url="${commons-collections-url}" dest="${sampleslib.dir}" name="commons-collections" version="${commons-collections.version}" />
- <pull url="${slf4j-api-url}" dest="${sampleslib.dir}" name="slf4j-api" version="${slf4j.version}" />
- </target>
-
<target name="clean" description="removes all generated collateral">
<delete dir="${classes.dir}" />
<delete dir="${javadoc.dir}" />
@@ -103,27 +34,42 @@
</delete>
<delete dir="${basedir}/plugin" />
</target>
+
+ <target name="yank" xmlns:yank="antlib:com.mebigfatguy.yank">
+ <mkdir dir="${lib.dir}" />
+ <yank:yank yankFile="${basedir}/yank.xls" destination="${lib.dir}" proxyServer="${proxy.server}" source="true">
+ <server url="http://repo1.maven.org/maven2" />
+ <generateVersions propertyFileName="${basedir}/version.properties" />
+ </yank:yank>
+ </target>
+
+ <target name="info">
+ <echo message="fb-contrib - a findbugs plugin"/>
+ <echo message=""/>
+ <echo message=" this project uses yank (https://github.com/mebigfatguy/yank) for dependency management"/>
+ <echo message=" download yank.jar and place in ant/lib directory"/>
+ <echo message=" http://search.maven.org/#artifactdetails%7Ccom.mebigfatguy.yank%7Cyank%7C0.4.2%7Cjar"/>
+ <antcall target="install"/>
+ </target>
- <target name="-init" description="prepares repository for a build">
+ <target name="-init" depends="yank" description="prepares repository for a build">
<mkdir dir="${lib.dir}" />
- <mkdir dir="${sampleslib.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${javadoc.dir}" />
<path id="fb-contrib.classpath">
<pathelement location="${lib.dir}/findbugs-${findbugs.version}.jar" />
- <pathelement location="${lib.dir}/findbugs-bcel-${findbugs-bcel.version}.jar" />
+ <pathelement location="${lib.dir}/bcel-${bcel.version}.jar" />
<pathelement location="${lib.dir}/annotations-${annotations.version}.jar" />
<pathelement location="${lib.dir}/asm-tree-${asm-tree.version}.jar" />
</path>
<path id="fb-contrib.samples.classpath">
- <pathelement location="${sampleslib.dir}/jsp-api-${jsp-api.version}.jar" />
- <pathelement location="${sampleslib.dir}/junit-${junit.version}.jar" />
- <pathelement location="${sampleslib.dir}/servlet-api-${servlet-api.version}.jar" />
- <pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar" />
- <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
- <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" />
- <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
- <pathelement location="${sampleslib.dir}/slf4j-api-${slf4j.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}/javax.servlet-api-${javax.servlet-api.version}.jar" />
+ <pathelement location="${lib.dir}/log4j-${log4j.version}.jar" />
+ <pathelement location="${lib.dir}/commons-lang3-${commons-lang3.version}.jar" />
+ <pathelement location="${lib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
+ <pathelement location="${lib.dir}/slf4j-api-${slf4j-api.version}.jar" />
</path>
<mkdir dir="${classes.dir}/com" />
<mkdir dir="${classes.dir}/com/mebigfatguy" />
@@ -140,7 +86,7 @@
</xmlvalidate>
</target>
- <target name="compile" depends="-init, pullall" description="compiles java files">
+ <target name="compile" depends="-init" description="compiles java files">
<javac srcdir="${src.dir}" destdir="${classes.dir}" source="${javac.source}" target="${javac.target}" deprecation="${javac.deprecation}" debug="${javac.debug}" includeantruntime="false">
<classpath refid="fb-contrib.classpath" />
</javac>
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2013-11-17 21:58:00 UTC (rev 1757)
+++ trunk/fb-contrib/etc/findbugs.xml 2013-12-11 03:20:25 UTC (rev 1758)
@@ -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" />
@@ -177,7 +177,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" />
+ <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" />
<Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" />
@@ -248,12 +248,12 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.InvalidConstantArgument" speed="fast" reports="ICA_INVALID_CONSTANT_ARRAY" />
- <!--
+ <!-- COMMENT OUT FOR POINT RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.ArrayIndexOutOfBounds" speed="fast" reports="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS,AIOB_ARRAY_STORE_TO_NULL_REFERENCE" />
- -->
-
+ COMMENT OUT FOR POINT RELEASE -->
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -385,6 +385,7 @@
<BugPattern abbrev="LO" type="LO_STUTTERED_MESSAGE" category="STYLE" />
<BugPattern abbrev="LO" type="LO_INVALID_FORMATTING_ANCHOR" category="CORRECTNESS" />
<BugPattern abbrev="LO" type="LO_INCORRECT_NUMBER_OF_ANCHOR_PARAMETERS" category="CORRECTNESS" />
+ <BugPattern abbrev="LO" type="LO_EXCEPTION_WITH_LOGGER_PARMS" 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" />
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-11-17 21:58:00 UTC (rev 1757)
+++ trunk/fb-contrib/etc/messages.xml 2013-12-11 03:20:25 UTC (rev 1758)
@@ -6,11 +6,9 @@
<ShortDescription>fb-contrib plugin</ShortDescription>
<Details>
<![CDATA[
- <p>
- This plugin contains FindBugs detectors from the fb-contrib project
- </p>
+ <p>This plugin contains FindBugs detectors from the fb-contrib project</p>
]]>
- </Details>
+ </Details>
</Plugin>
<!-- Detectors -->
@@ -20,61 +18,61 @@
<![CDATA[
<p>Collects statistics for other detectors</p>
]]>
- </Details>
+ </Details>
</Detector>
<Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering">
<Details>
<![CDATA[
- <p> Looks for appending strings inside of calls to StringBuffer or StringBuilder append.</p>
- <p> <pre>
+ <p>Looks for appending strings inside of calls to StringBuffer or StringBuilder append.</p>
+ <pre>
StringBuffer sb = new StringBuffer();
sb.append(a + b);
return sb.toString();
- </pre></p>
+ </pre>
<p>It is a fast detector</p>
]]>
- </Details>
+ </Details>
</Detector>
<Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators">
<Details>
<![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,
+ <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,
which is explicitly unsafe. When iterators are to be used, synchronization should be done manually.</p>
<p>It is a slow detector</p>
]]>
- </Details>
+ </Details>
</Detector>
<Detector class="com.mebigfatguy.fbcontrib.detect.CyclomaticComplexity">
<Details>
<![CDATA[
- <p> Calculates the McCabe Cyclomatic Complexity measure and reports methods that have an
+ <p>Calculates the McCabe Cyclomatic Complexity measure and reports methods that have an
excessive value. This report value can be set with system property 'fb-contrib.cc.limit'.</p>
<p>It is a slow detector</p>
]]>
- </Details>
+ </Details>
</Detector>
<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 use methods defined by an
implemented interface or super class 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>
]]>
- </Details>
+ </Details>
</Detector>
<Detector class="com.mebigfatguy.fbcontrib.detect.ListIndexedIterating">
<Details>
<![CDATA[
- <p> Looks for for loops that iterate over a java.util.List using an integer index, and get,
- rather than using an Iterator. An iterator may perform better depending on List implementation,
+ <p>Looks for for loops that iterate over a java.util.List using an integer index, and get,
+ rather than using an Iterator. An iterator may perform better depending on List implementation,
but more importantly will allow the code to be converted to other collection types.</p>
<p>It is a moderately fast detector</p>
]]>
@@ -84,7 +82,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents">
<Details>
<![CDATA[
- <p> Looks for collections or arrays that hold objects that are unrelated through class or
+ <p>Looks for collections or arrays that hold objects that are unrelated through class or
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,
@@ -98,7 +96,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException">
<Details>
<![CDATA[
- <p> Looks for methods that declare Runtime exceptions in their throws clause. While doing
+ <p>Looks for methods that declare Runtime exceptions in their throws clause. While doing
so is not illegal, it may represent a misunderstanding as to the exception in question.
If a RuntimeException is declared, it implies that this exception type is expected to happen,
which if true should be handled in code, and not propagated. </p>
@@ -111,7 +109,7 @@
<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 its 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>
@@ -123,7 +121,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison">
<Details>
<![CDATA[
- <p> Looks for methods that compare strings against literal strings, where the literal string
+ <p>Looks for methods that compare strings against literal strings, where the literal string
is passed as the parameter. If the .equals or .compareTo is called on the literal itself, passing
the variable as the parameter, you avoid the possibility of a NullPointerException.</p>
<p>It is a fast detector</p>
@@ -134,7 +132,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess">
<Details>
<![CDATA[
- <p> Looks for constructors of non final classes that make method calls to non final methods.
+ <p>Looks for constructors of non final classes that make method calls to non final methods.
As these methods could be overridden, the overridden method will be accessing an object that
is only partially constructed, perhaps causing problems.</p>
<p>It is a fast detector</p>
@@ -145,7 +143,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.DubiousListCollection">
<Details>
<![CDATA[
- <p> Looks for fields that are implementations of java.util.List, but that are used in a set-like fashion.
+ <p>Looks for fields that are implementations of java.util.List, but that are used in a set-like fashion.
Since lookup type operations are performed using a linear search for Lists, the performance for large
Lists will be poor. Consideration should be made as to whether these fields should be sets. In the
case that order is important, consider using LinkedHashSet.</p>
@@ -157,7 +155,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ParallelLists">
<Details>
<![CDATA[
- <p> Looks for classes that maintain two or more lists or arrays associated one-for-one through the same index
+ <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
related in key/value fashion, then a map.</p>
@@ -180,7 +178,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbstractClassEmptyMethods">
<Details>
<![CDATA[
- <p> Looks for abstract classes that define empty methods or methods that simply throw an
+ <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
as abstract, so that correct subclass behaviour is enforced.</p>
<p>It is a fast detector</p>
@@ -191,7 +189,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ManualArrayCopy">
<Details>
<![CDATA[
- <p> Looks for methods that copy data from one array to another using a loop. It is
+ <p>Looks for methods that copy data from one array to another using a loop. It is
better performing to use System.arraycopy to do such copying as this is a native method.</p>
<p>It is a fast detector</p>
]]>
@@ -201,7 +199,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.FloatingPointLoops">
<Details>
<![CDATA[
- <p> Looks for methods that use floating point indexes for loops. Since floating point
+ <p>Looks for methods that use floating point indexes for loops. Since floating point
math is inprecise, rounding errors will occur each time through the loop causing
hard to find problems. It is usually better to use integer indexing, and calculating
the correct floating point value from the index.</p>
@@ -213,7 +211,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.NonCollectionMethodUse">
<Details>
<![CDATA[
- <p> Looks for method calls to collection classes where the method is not defined by the Collections
+ <p>Looks for method calls to collection classes where the method is not defined by the Collections
interface, and an equivalent method exists in the interface. Examples include:<br>
<table border="1">
<tr><th>Old Method</th><th>New Method</th></tr>
@@ -237,15 +235,15 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingAutoboxedOverloading">
<Details>
<![CDATA[
- <p> Looks for methods that have the same signature, except where one uses a
+ <p>Looks for methods that have the same signature, except where one uses a
Character parameter, and the other uses an int, long, float, double parameter.
Since autoboxing is available in 1.5 one might assume that
<pre>
- test('a')
+ test('a')
</pre>
would map to
<pre>
- public void test(Character c)
+ public void test(Character c)
</pre>
but instead maps to one that takes an int, long, float or double.
</p>
@@ -257,11 +255,10 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.AbnormalFinallyBlockReturn">
<Details>
<![CDATA[
- <p> Looks for methods that have finally blocks that return values
- or throw exceptions. This code will swallow normal program flow and
- hide real program logic.
- </p>
- <p>It is a fast detector</p>
+ <p>Looks for methods that have finally blocks that return values
+ or throw exceptions. This code will swallow normal program flow and
+ hide real program logic.</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -269,11 +266,10 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.StaticMethodInstanceInvocation">
<Details>
<![CDATA[
- <p> Looks for methods that make static method calls using an instance reference.
+ <p>Looks for methods that make static method calls using an instance reference.
For documentation purposes, it is better to call the method using the class name.
- This may represent a change in definition that should be noticed.
- </p>
- <p>It is a fast detector</p>
+ This may represent a change in definition that should be noticed.</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -281,7 +277,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SpuriousThreadStates">
<Details>
<![CDATA[
- <p> Looks for methods that call wait, notify or notifyAll on an instance of a
+ <p>Looks for methods that call wait, notify or notifyAll on an instance of a
java.lang.Thread. Since the internal workings of the threads is to synchronize on the
thread itself, introducing client calls will confuse the thread state of the object
in question, and will cause spurious thread state changes, either waking threads up
@@ -294,7 +290,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessAutoboxing">
<Details>
<![CDATA[
- <p> Looks for methods that pass a primitive wrapper class object to the
+ <p>Looks for methods that pass a primitive wrapper class object to the
same class' Constructor. Patterns found are:
<ul>
<li>new Boolean(Boolean)</li>
@@ -310,7 +306,7 @@
<p>It also looks for calls to BoxedClass.valueOf(x) where X is already a Boxed class</p>
<p>It also looks for calls to BoxedClass.valueOf(myString).boxedValue(), when instead it is
simpler to use BoxedClass.parseBoxed(myString)</p>
- <p>It is a fast detector</p>
+ <p>It is a fast detector</p>
]]>
</Details>
</Detector>
@@ -372,7 +368,7 @@
<Details>
<![CDATA[
<p>Looks for methods that build XML based strings by concatenation strings
- and custom values together. Doing so makes brittle code, that is difficult to
+ 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>It is a fast detector<...
[truncated message content] |
|
From: <dbr...@us...> - 2014-01-15 20:25:09
|
Revision: 1761
http://sourceforge.net/p/fb-contrib/code/1761
Author: dbrosius
Date: 2014-01-15 20:25:00 +0000 (Wed, 15 Jan 2014)
Log Message:
-----------
Merge from Github for release 5.0.2
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
trunk/fb-contrib/htdocs/index.shtml
trunk/fb-contrib/htdocs/mbfg_menu.shtml
trunk/fb-contrib/pom.xml
trunk/fb-contrib/samples/CU_Sample.java
trunk/fb-contrib/samples/LEST_Sample.java
trunk/fb-contrib/samples/OCP_Sample.java
trunk/fb-contrib/samples/OC_Sample.java
trunk/fb-contrib/samples/SG_Sample.java
trunk/fb-contrib/samples/SPP_Sample.java
trunk/fb-contrib/samples/WOC_Sample.java
trunk/fb-contrib/samples/samples.fbp
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/debug/OCSDebugger.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayIndexOutOfBounds.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingArrayAsList.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InvalidConstantArgument.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonProductiveMethodCall.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PresizeCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TailRecursion.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnboundMethodTemplateParameter.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseSplit.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java
trunk/fb-contrib/yank.xls
Added Paths:
-----------
trunk/fb-contrib/samples/CNC_Sample.java
trunk/fb-contrib/samples/PME_Sample.java
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/.classpath 2014-01-15 20:25:00 UTC (rev 1761)
@@ -11,11 +11,12 @@
<classpathentry kind="lib" path="lib/bcel-2.0.2.jar"/>
<classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar"/>
- <classpathentry kind="lib" path="lib/findbugs-2.0.2.jar"/>
<classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
<classpathentry kind="lib" path="lib/javax.servlet.jsp-api-2.2.1.jar"/>
<classpathentry kind="lib" path="lib/junit-4.11.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/slf4j-api-1.7.5.jar"/>
+ <classpathentry kind="lib" path="lib/findbugs-2.0.3.jar"/>
+ <classpathentry kind="lib" path="lib/guava-15.0.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/build.xml 2014-01-15 20:25:00 UTC (rev 1761)
@@ -2,6 +2,7 @@
<project name="fb-contrib" default="info">
+ <property file="user.properties" />
<property file="build.properties" />
<property file="version.properties" />
@@ -17,7 +18,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="5.0.1" />
+ <property name="fb-contrib.version" value="5.0.2" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -70,6 +71,7 @@
<pathelement location="${lib.dir}/commons-lang3-${commons-lang3.version}.jar" />
<pathelement location="${lib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" />
<pathelement location="${lib.dir}/slf4j-api-${slf4j-api.version}.jar" />
+ <pathelement location="${lib.dir}/guava-${guava.version}.jar" />
</path>
<mkdir dir="${classes.dir}/com" />
<mkdir dir="${classes.dir}/com/mebigfatguy" />
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/etc/findbugs.xml 2014-01-15 20:25:00 UTC (rev 1761)
@@ -15,7 +15,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" />
@@ -146,7 +146,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast"
- reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_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_NON_ARRAY_PARM,SPP_EMPTY_CASING,SPP_TEMPORARY_TRIM,SPP_STRINGBUILDER_IS_MUTABLE,SPP_USE_GET0,SPP_DOUBLE_APPENDED_LITERALS,SPP_NULL_BEFORE_INSTANCEOF" />
+ 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_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" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" />
@@ -248,10 +248,15 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.InvalidConstantArgument" speed="fast" reports="ICA_INVALID_CONSTANT_ARRAY" />
- <!-- COMMENT OUT FOR POINT RELEASE
+ <!-- COMMENT OUT FOR POINT RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.ArrayIndexOutOfBounds" speed="fast" reports="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS,AIOB_ARRAY_STORE_TO_NULL_REFERENCE" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.CollectionNamingConfusion" speed="fast" reports="CNC_COLLECTION_NAMING_CONFUSION" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.PoorMansEnum" speed="fast" reports="PME_POOR_MANS_ENUM" />
+
COMMENT OUT FOR POINT RELEASE -->
<!-- BugPattern -->
@@ -356,6 +361,7 @@
<BugPattern abbrev="SPP" type="SPP_USE_GET0" category="PERFORMANCE" />
<BugPattern abbrev="SPP" type="SPP_DOUBLE_APPENDED_LITERALS" category="PERFORMANCE" />
<BugPattern abbrev="SPP" type="SPP_NULL_BEFORE_INSTANCEOF" category="CORRECTNESS" />
+ <BugPattern abbrev="SPP" type="SPP_NON_USEFUL_TOSTRING" category="STYLE" />
<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" />
@@ -447,4 +453,6 @@
<BugPattern abbrev="AIOB" type="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS" category="CORRECTNESS" />
<BugPattern abbrev="AIOB" type="AIOB_ARRAY_STORE_TO_NULL_REFERENCE" category="CORRECTNESS" />
<BugPattern abbrev="ICA" type="ICA_INVALID_CONSTANT_ARGUMENT" category="CORRECTNESS" />
+ <BugPattern abbrev="CNC" type="CNC_COLLECTION_NAMING_CONFUSION" category="STYLE" />
+ <BugPattern abbrev="PME" type="PME_POOR_MANS_ENUM" category="STYLE" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/etc/messages.xml 2014-01-15 20:25:00 UTC (rev 1761)
@@ -1348,6 +1348,29 @@
]]>
</Details>
</Detector>
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.CollectionNamingConfusion">
+ <Details>
+ <![CDATA[
+ <p>Looks for fields or local variables that are collections but which names have a different type
+ of collection in the name. This is confusing, and is probably a left over from a type change, such as
+ </p>
+ <p>List<String> mySet;</p>
+ <p>It is a fast detector</p>
+ ]]>
+ </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
+ only assigned a set of constant values. This variable probably should be redefined as an enum.
+ </p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger">
<Details></Details>
@@ -2650,6 +2673,18 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="SPP_NON_USEFUL_TOSTRING">
+ <ShortDescription>Method calls toString() on an instance of a class that hasn't overridden toString()</ShortDescription>
+ <LongDescription>Method {1} calls toString() on an instance of a class that hasn't overridden toString()</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method calls toString() on an object that hasn't overridden the toString() method, and thus relies on
+ the version found in java.lang.Object. This string is just a raw display of the object's class and location, and
+ provides no information about the information of use. You should implement toString in this class.
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE">
<ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription>
@@ -3771,6 +3806,30 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="CNC_COLLECTION_NAMING_CONFUSION">
+ <ShortDescription>Collection variable is named with a different type of collection in the name</ShortDescription>
+ <LongDescription>Collection variable {2} is named with a different type of collection in the name</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This class defines a field or local collection variable with a name that contains a different type
+ of collection in it's name. This is confusing to the reader, and likely caused by a previous refactor of
+ type, without changing the name.</p>
+ ]]>
+ </Details>
+ </BugPattern>
+
+ <BugPattern type="PME_POOR_MANS_ENUM">
+ <ShortDescription>Simple field is used like an enum</ShortDescription>
+ <LongDescription>Simple field {1} is used like an enum</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This field, although defined as a simple variable (int, String, etc) only has a set of constant values
+ assigned to it. This appears to be used like an enum value, and should probably be defined as such.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
<!-- BugCode -->
@@ -3886,4 +3945,6 @@
<BugCode abbrev="NPMC">Non Productive Method Call</BugCode>
<BugCode abbrev="AIOB">Array Index Out of Bounds</BugCode>
<BugCode abbrev="ICA">Invalid Constant Argument</BugCode>
+ <BugCode abbrev="CNC">Collection Naming Confusion</BugCode>
+ <BugCode abbrev="PME">Poor Mans Enum</BugCode>
</MessageCollection>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/htdocs/index.shtml 2014-01-15 20:25:00 UTC (rev 1761)
@@ -98,6 +98,14 @@
</li>
</ul>
</li>
+ <li><b>[CNC] Collection Naming Confusion</b><br/>
+ Looks for fields and local variables that have Map, Set, List in their names
+ but the variable is a collection of a different basic type.
+ </li>
+ <li><b>[PME] Poor Mans Enum</b><br/>
+ Looks for simple fields that only store one of several constant values. This usually is an indication
+ that this field should really be an enum type.
+ </li>
</ul>
</div>
<hr/>
Modified: trunk/fb-contrib/htdocs/mbfg_menu.shtml
===================================================================
--- trunk/fb-contrib/htdocs/mbfg_menu.shtml 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/htdocs/mbfg_menu.shtml 2014-01-15 20:25:00 UTC (rev 1761)
@@ -12,7 +12,7 @@
<li><a href="http://schemalizer.sf.net">Schemalizer</a></li>
<li><a href="http://tomailer.sf.net">ToMailer</a></li>
<li><a href="http://jd4a.sf.net">JavaDoc for Android</a></li>
- <il><a href="http://damus.sf.net">Damus</a></li>
+ <li><a href="http://damus.sf.net">Damus</a></li>
<li><a href="http://www.heartofgoldfarm.com">Heart of Gold Farm</a></li>
</ul>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/pom.xml 2014-01-15 20:25:00 UTC (rev 1761)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>5.0.1</version>
+ <version>5.0.2</version>
<parent>
<groupId>org.sonatype.oss</groupId>
@@ -103,7 +103,7 @@
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>findbugs</artifactId>
- <version>2.0.1</version>
+ <version>2.0.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
Added: trunk/fb-contrib/samples/CNC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/CNC_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/CNC_Sample.java 2014-01-15 20:25:00 UTC (rev 1761)
@@ -0,0 +1,14 @@
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+public class CNC_Sample {
+ Map<String, String> argList;
+ Set<Integer> targetMap;
+ List<Double> bernoulliSet;
+
+ public void testCNC(Map<String, String> argSet, Set<String> nameList, List<String> nameMap) {
+
+ }
+}
Property changes on: trunk/fb-contrib/samples/CNC_Sample.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/fb-contrib/samples/CU_Sample.java
===================================================================
--- trunk/fb-contrib/samples/CU_Sample.java 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/samples/CU_Sample.java 2014-01-15 20:25:00 UTC (rev 1761)
@@ -37,4 +37,10 @@
public void run() {
}
}
+
+ class FPActuallyThrow implements Cloneable {
+ public FPActuallyThrow clone() throws CloneNotSupportedException {
+ throw new CloneNotSupportedException("Silly");
+ }
+ }
}
Modified: trunk/fb-contrib/samples/LEST_Sample.java
===================================================================
--- trunk/fb-contrib/samples/LEST_Sample.java 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/samples/LEST_Sample.java 2014-01-15 20:25:00 UTC (rev 1761)
@@ -1,9 +1,13 @@
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import com.google.common.base.Throwables;
+
@SuppressWarnings("all")
public class LEST_Sample
{
@@ -159,6 +163,18 @@
throw new Exception("message");
}
}
+
+ public void fpThrowables()
+ {
+ try
+ {
+ InputStream is = new FileInputStream("foo");
+ }
+ catch (IOException e)
+ {
+ throw Throwables.propagate(e);
+ }
+ }
private Exception wrap(Exception e) {
return new Exception(e);
Modified: trunk/fb-contrib/samples/OCP_Sample.java
===================================================================
--- trunk/fb-contrib/samples/OCP_Sample.java 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/samples/OCP_Sample.java 2014-01-15 20:25:00 UTC (rev 1761)
@@ -10,15 +10,15 @@
import java.util.Iterator;
import java.util.LinkedList;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
@SuppressWarnings("all")
public class OCP_Sample extends Z implements ActionListener, Serializable
{
Modified: trunk/fb-contrib/samples/OC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/OC_Sample.java 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/samples/OC_Sample.java 2014-01-15 20:25:00 UTC (rev 1761)
@@ -1,5 +1,5 @@
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.ArrayList;
@SuppressWarnings("all")
public class OC_Sample
Added: trunk/fb-contrib/samples/PME_Sample.java
===================================================================
--- trunk/fb-contrib/samples/PME_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/PME_Sample.java 2014-01-15 20:25:00 UTC (rev 1761)
@@ -0,0 +1,32 @@
+
+public class PME_Sample {
+
+ private int v;
+ private String s;
+ private String fps;
+ private boolean fpb;
+
+ public void foo() {
+ v = 1;
+ s = "Fee";
+ fps = "Hello";
+ fpb = true;
+ }
+
+ public void foo2() {
+ v =- 2;
+ s = "Fi";
+ fps = "Hi";
+ fpb = false;
+ }
+
+ public void foo3() {
+ v = 3;
+ s = "Fo";
+ fps = "Chow";
+ }
+
+ public void foo4(String x) {
+ fps = x;
+ }
+}
Property changes on: trunk/fb-contrib/samples/PME_Sample.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/fb-contrib/samples/SG_Sample.java
===================================================================
--- trunk/fb-contrib/samples/SG_Sample.java 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/samples/SG_Sample.java 2014-01-15 20:25:00 UTC (rev 1761)
@@ -5,11 +5,11 @@
import java.io.ByteArrayInputStream;
import java.io.FileReader;
+import org.w3c.dom.Document;
+
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.w3c.dom.Document;
-
@SuppressWarnings("all")
public class SG_Sample implements ActionListener, WindowListener
{
Modified: trunk/fb-contrib/samples/SPP_Sample.java
===================================================================
--- trunk/fb-contrib/samples/SPP_Sample.java 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/samples/SPP_Sample.java 2014-01-15 20:25:00 UTC (rev 1761)
@@ -384,4 +384,11 @@
}
return Math.random() > 0.5;
}
+
+ public void testToString() {
+ SPP_Sample s = new SPP_Sample();
+ System.out.println(s.toString());
+ /* only report it once */
+ System.out.println(s.toString());
+ }
}
Modified: trunk/fb-contrib/samples/WOC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/WOC_Sample.java 2013-12-11 03:45:55 UTC (rev 1760)
+++ trunk/fb-contrib/samples/WOC_Sample.java 2014-01-15 20:25:00 UTC (rev 1761)
@@ -15,6 +15,8 @@
private final Set<String> memberSet = new HashSet<String>();
private Set<String> fpSet;
private final List<String> fpList = new ArrayList<String>();
+ private List<String> fp1 = new ArrayList<String>();
+ private List<String> fp...
[truncated message content] |
|
From: <dbr...@us...> - 2014-02-17 21:23:02
|
Revision: 1765
http://sourceforge.net/p/fb-contrib/code/1765
Author: dbrosius
Date: 2014-02-17 21:22:53 +0000 (Mon, 17 Feb 2014)
Log Message:
-----------
merge from git, prepare for 5.0.3 release
Modified Paths:
--------------
trunk/fb-contrib/.classpath
trunk/fb-contrib/build.xml
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/samples/ABC_Sample.java
trunk/fb-contrib/samples/ACEM_Sample.java
trunk/fb-contrib/samples/AFBR_Sample.java
trunk/fb-contrib/samples/AIOB_Sample.java
trunk/fb-contrib/samples/AOM_Sample.java
trunk/fb-contrib/samples/AWCBR_Sample.java
trunk/fb-contrib/samples/BAS_Sample.java
trunk/fb-contrib/samples/BED_Sample.java
trunk/fb-contrib/samples/BSB_Sample.java
trunk/fb-contrib/samples/CAAL_Sample.java
trunk/fb-contrib/samples/CAO_Sample.java
trunk/fb-contrib/samples/CBX_Sample.java
trunk/fb-contrib/samples/CCNE_Sample.java
trunk/fb-contrib/samples/CEBE_EqualsToEqualsSample.java
trunk/fb-contrib/samples/CE_Sample.java
trunk/fb-contrib/samples/CFS_Sample.java
trunk/fb-contrib/samples/CHBH_HashcodeToHashcodeSample.java
trunk/fb-contrib/samples/CLI_Sample.java
trunk/fb-contrib/samples/CNC_Sample.java
trunk/fb-contrib/samples/COM_Sample.java
trunk/fb-contrib/samples/CSBTS_StringToStringSample.java
trunk/fb-contrib/samples/CU_Sample.java
trunk/fb-contrib/samples/CVAA_Sample.java
trunk/fb-contrib/samples/DDC_Sample.java
trunk/fb-contrib/samples/DLC_Sample.java
trunk/fb-contrib/samples/DRE_Sample.java
trunk/fb-contrib/samples/DSOC_Sample.java
trunk/fb-contrib/samples/DTEP_Sample.java
trunk/fb-contrib/samples/DWI_Sample.java
trunk/fb-contrib/samples/EXS_Sample.java
trunk/fb-contrib/samples/FCBL_Sample.java
trunk/fb-contrib/samples/FPL_Sample.java
trunk/fb-contrib/samples/FP_Sample.java
trunk/fb-contrib/samples/ICA_Sample.java
trunk/fb-contrib/samples/IICU_Sample.java
trunk/fb-contrib/samples/IKNC_Sample.java
trunk/fb-contrib/samples/IPU_Sample.java
trunk/fb-contrib/samples/ISB_Sample.java
trunk/fb-contrib/samples/ITC_Sample.java
trunk/fb-contrib/samples/ITU_Sample.java
trunk/fb-contrib/samples/JAO_Sample.java
trunk/fb-contrib/samples/JVR_Sample.java
trunk/fb-contrib/samples/LEST_Sample.java
trunk/fb-contrib/samples/LGO_Sample.java
trunk/fb-contrib/samples/LII_Sample.java
trunk/fb-contrib/samples/LO_Sample.java
trunk/fb-contrib/samples/LSC_Sample.java
trunk/fb-contrib/samples/LSYC_Sample.java
trunk/fb-contrib/samples/MAC_Sample.java
trunk/fb-contrib/samples/MDM_Sample.java
trunk/fb-contrib/samples/MOM_Sample.java
trunk/fb-contrib/samples/MRC_Sample.java
trunk/fb-contrib/samples/MTA_Sample.java
trunk/fb-contrib/samples/NAB_Sample.java
trunk/fb-contrib/samples/NCMU_Sample.java
trunk/fb-contrib/samples/NCS_Sample.java
trunk/fb-contrib/samples/NFF_Sample.java
trunk/fb-contrib/samples/NIR_Sample.java
trunk/fb-contrib/samples/NMCS_Sample.java
trunk/fb-contrib/samples/NOS_Sample.java
trunk/fb-contrib/samples/NPMC_Sample.java
trunk/fb-contrib/samples/NRTL_Sample.java
trunk/fb-contrib/samples/NSE_Sample.java
trunk/fb-contrib/samples/OCP_Sample.java
trunk/fb-contrib/samples/OC_Sample.java
trunk/fb-contrib/samples/ODN_Sample.java
trunk/fb-contrib/samples/PCAIL_Sample.java
trunk/fb-contrib/samples/PCOA_Sample.java
trunk/fb-contrib/samples/PDP_Sample.java
trunk/fb-contrib/samples/PIS_Sample.java
trunk/fb-contrib/samples/PL_Sample.java
trunk/fb-contrib/samples/PMB_Sample.java
trunk/fb-contrib/samples/PME_Sample.java
trunk/fb-contrib/samples/PRMC_Sample.java
trunk/fb-contrib/samples/PSC_Sample.java
trunk/fb-contrib/samples/PUS_Sample.java
trunk/fb-contrib/samples/ROOM_Sample.java
trunk/fb-contrib/samples/S508C_Sample.java
trunk/fb-contrib/samples/SACM_Sample.java
trunk/fb-contrib/samples/SCA_Sample.java
trunk/fb-contrib/samples/SCII_Sample.java
trunk/fb-contrib/samples/SCI_Sample.java
trunk/fb-contrib/samples/SCRV_Sample.java
trunk/fb-contrib/samples/SCR_Sample.java
trunk/fb-contrib/samples/SCSS_Sample.java
trunk/fb-contrib/samples/SC_Sample.java
trunk/fb-contrib/samples/SEC_Sample.java
trunk/fb-contrib/samples/SGSU_Sample.java
trunk/fb-contrib/samples/SG_Sample.java
trunk/fb-contrib/samples/SIL_Sample.java
trunk/fb-contrib/samples/SJVU_Sample.java
trunk/fb-contrib/samples/SMA_Sample.java
trunk/fb-contrib/samples/SMII_Sample.java
trunk/fb-contrib/samples/SNG_Sample.java
trunk/fb-contrib/samples/SPP_Sample.java
trunk/fb-contrib/samples/STB_Sample.java
trunk/fb-contrib/samples/STS_Sample.java
trunk/fb-contrib/samples/SUA_Sample.java
trunk/fb-contrib/samples/SWCO_Sample.java
trunk/fb-contrib/samples/TBP_Sample.java
trunk/fb-contrib/samples/TR_Sample.java
trunk/fb-contrib/samples/UAA_Sample.java
trunk/fb-contrib/samples/UCC_Sample.java
trunk/fb-contrib/samples/UCPM_Sample.java
trunk/fb-contrib/samples/UEC_Sample.java
trunk/fb-contrib/samples/UMTP_Sample.java
trunk/fb-contrib/samples/UNNC_Sample.java
trunk/fb-contrib/samples/URV_Sample.java
trunk/fb-contrib/samples/USBR_Sample.java
trunk/fb-contrib/samples/USS_Sample.java
trunk/fb-contrib/samples/UTA_Sample.java
trunk/fb-contrib/samples/UVA_Sample.java
trunk/fb-contrib/samples/WEM_Sample.java
trunk/fb-contrib/samples/WOC_Sample.java
trunk/fb-contrib/samples/samples.fbp
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java
Added Paths:
-----------
trunk/fb-contrib/samples/UP_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnusedParameter.java
Removed Paths:
-------------
trunk/fb-contrib/META-INF/
Modified: trunk/fb-contrib/.classpath
===================================================================
--- trunk/fb-contrib/.classpath 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/.classpath 2014-02-17 21:22:53 UTC (rev 1765)
@@ -5,18 +5,18 @@
<classpathentry excluding="lib/" kind="src" path="samples"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/findbugs"/>
- <classpathentry kind="lib" path="lib/annotations-2.0.2.jar"/>
<classpathentry kind="lib" path="lib/asm-tree-3.3.1.jar"/>
<classpathentry kind="lib" path="lib/backport-util-concurrent-3.1.jar"/>
<classpathentry kind="lib" path="lib/bcel-2.0.2.jar"/>
<classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/>
- <classpathentry kind="lib" path="lib/commons-lang3-3.1.jar"/>
<classpathentry kind="lib" path="lib/javax.servlet-api-3.1.0.jar"/>
- <classpathentry kind="lib" path="lib/javax.servlet.jsp-api-2.2.1.jar"/>
<classpathentry kind="lib" path="lib/junit-4.11.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/slf4j-api-1.7.5.jar"/>
<classpathentry kind="lib" path="lib/findbugs-2.0.3.jar"/>
<classpathentry kind="lib" path="lib/guava-15.0.jar"/>
+ <classpathentry kind="lib" path="lib/annotations-2.0.3.jar"/>
+ <classpathentry kind="lib" path="lib/commons-lang3-3.2.jar"/>
+ <classpathentry kind="lib" path="lib/javax.servlet.jsp-api-2.3.1.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
Modified: trunk/fb-contrib/build.xml
===================================================================
--- trunk/fb-contrib/build.xml 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/build.xml 2014-02-17 21:22:53 UTC (rev 1765)
@@ -18,7 +18,7 @@
<property name="javac.deprecation" value="on" />
<property name="javac.debug" value="on" />
- <property name="fb-contrib.version" value="5.0.2" />
+ <property name="fb-contrib.version" value="5.0.3" />
<property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" />
@@ -49,7 +49,7 @@
<echo message=""/>
<echo message=" this project uses yank (https://github.com/mebigfatguy/yank) for dependency management"/>
<echo message=" download yank.jar and place in ant/lib directory"/>
- <echo message=" http://search.maven.org/#artifactdetails%7Ccom.mebigfatguy.yank%7Cyank%7C0.4.2%7Cjar"/>
+ <echo message=" http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.mebigfatguy.yank%22"/>
<antcall target="install"/>
</target>
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/etc/findbugs.xml 2014-02-17 21:22:53 UTC (rev 1765)
@@ -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" />
@@ -106,7 +106,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.JDBCVendorReliance" speed="fast" reports="JVR_JDBC_VENDOR_RELIANCE" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.PossibleMemoryBloat" speed="fast" reports="PMB_POSSIBLE_MEMORY_BLOAT" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.PossibleMemoryBloat" speed="fast" reports="PMB_POSSIBLE_MEMORY_BLOAT,PMB_INSTANCE_BASED_THREAD_LOCAL" />
<Detector class="com.mebigfatguy.fbcontrib.detect.LocalSynchronizedCollection" speed="moderate" reports="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" />
@@ -146,7 +146,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" speed="fast" reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast"
- reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_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_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" />
+ 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_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" />
<Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" speed="fast" reports="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" />
@@ -248,7 +248,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.InvalidConstantArgument" speed="fast" reports="ICA_INVALID_CONSTANT_ARRAY" />
- <!-- COMMENT OUT FOR POINT RELEASE
+ <!-- COMMENT OUT FOR POINT RELEASE
<Detector class="com.mebigfatguy.fbcontrib.detect.PresizeCollections" speed="fast" reports="PSC_PRESIZE_COLLECTIONS" />
<Detector class="com.mebigfatguy.fbcontrib.detect.ArrayIndexOutOfBounds" speed="fast" reports="AIOB_ARRAY_INDEX_OUT_OF_BOUNDS,AIOB_ARRAY_STORE_TO_NULL_REFERENCE" />
@@ -257,8 +257,10 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.PoorMansEnum" speed="fast" reports="PME_POOR_MANS_ENUM" />
- COMMENT OUT FOR POINT RELEASE -->
+ <Detector class="com.mebigfatguy.fbcontrib.detect.UnusedParameter" speed="fast" reports="UP_UNUSED_PARAMETER" />
+ COMMENT OUT FOR POINT RELEASE -->
+
<!-- BugPattern -->
<BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" />
@@ -308,6 +310,7 @@
<BugPattern abbrev="SWCO" type="SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT" category="CORRECTNESS" />
<BugPattern abbrev="JVR" type="JVR_JDBC_VENDOR_RELIANCE" category="CORRECTNESS" />
<BugPattern abbrev="PMB" type="PMB_POSSIBLE_MEMORY_BLOAT" category="CORRECTNESS" />
+ <BugPattern abbrev="PMB" type="PMB_INSTANCE_BASED_THREAD_LOCAL" category="CORRECTNESS" />
<BugPattern abbrev="LSYC" type="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" category="CORRECTNESS" />
<BugPattern abbrev="FCBL" type="FCBL_FIELD_COULD_BE_LOCAL" category="CORRECTNESS" />
<BugPattern abbrev="NRTL" type="NRTL_NON_RECYCLEABLE_TAG_LIB" category="CORRECTNESS"/>
@@ -362,6 +365,7 @@
<BugPattern abbrev="SPP" type="SPP_DOUBLE_APPENDED_LITERALS" category="PERFORMANCE" />
<BugPattern abbrev="SPP" type="SPP_NULL_BEFORE_INSTANCEOF" category="CORRECTNESS" />
<BugPattern abbrev="SPP" type="SPP_NON_USEFUL_TOSTRING" category="STYLE" />
+ <BugPattern abbrev="SPP" type="SPP_TOSTRING_ON_STRING" 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" />
@@ -455,4 +459,5 @@
<BugPattern abbrev="ICA" type="ICA_INVALID_CONSTANT_ARGUMENT" category="CORRECTNESS" />
<BugPattern abbrev="CNC" type="CNC_COLLECTION_NAMING_CONFUSION" category="STYLE" />
<BugPattern abbrev="PME" type="PME_POOR_MANS_ENUM" category="STYLE" />
+ <BugPattern abbrev="UP" type="UP_UNUSED_PARAMETER" category="STYLE" />
</FindbugsPlugin>
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/etc/messages.xml 2014-02-17 21:22:53 UTC (rev 1765)
@@ -1352,7 +1352,7 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.CollectionNamingConfusion">
<Details>
<![CDATA[
- <p>Looks for fields or local variables that are collections but which names have a different type
+ <p>Looks for fields or local variables that are collections but the names have a different type
of collection in the name. This is confusing, and is probably a left over from a type change, such as
</p>
<p>List<String> mySet;</p>
@@ -1371,6 +1371,16 @@
]]>
</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.</p>
+ <p>It is fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
<Detector class="com.mebigfatguy.fbcontrib.debug.OCSDebugger">
<Details></Details>
@@ -1409,7 +1419,7 @@
<Details>
<![CDATA[
<p>This method concatenates the output of a toString() call into a StringBuffer/Builder.
- It is simpler just pass the object you want to append to the to append call, as that form
+ It is simpler just to pass the object you want to append to the append call, as that form
does not suffer the potential for NullPointerExceptions, and is easier to read.</p>
]]>
</Details>
@@ -2004,6 +2014,21 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="PMB_INSTANCE_BASED_THREAD_LOCAL">
+ <ShortDescription>Field is an instance based ThreadLocal variable</ShortDescription>
+ <LongDescription>Field {1} is an instance based ThreadLocal variable</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This ThreadLocal field is defined as being instance based (not static). As all
+ ThreadLocal variables describe permanent reachability roots so far as the garbage
+ collector is concerned, these variables will never be reclaimed (so long as the Thread lives).
+ Since this ThreadLocal is instanced, you potentially will be creating many non reclaimable
+ variables, even after the owning instance has been reclaimed. It is almost a certainty that
+ you want to use static based ThreadLocal variables.</p>
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="LSYC_LOCAL_SYNCHRONIZED_COLLECTION">
<ShortDescription>Method creates local variable-based synchronized collection</ShortDescription>
@@ -2685,6 +2710,16 @@
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="SPP_TOSTRING_ON_STRING">
+ <ShortDescription>Method calls toString() on a String</ShortDescription>
+ <LongDescription>Method {1} calls toString() on a String</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This methods calls toString on a String. Just use the object itself if you want a String.</p>
+ ]]>
+ </Details>
+ </BugPattern>
<BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE">
<ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription>
@@ -3813,7 +3848,7 @@
<Details>
<![CDATA[
<p>This class defines a field or local collection variable with a name that contains a different type
- of collection in it's name. This is confusing to the reader, and likely caused by a previous refactor of
+ of collection in its name. This is confusing to the reader, and likely caused by a previous refactor of
type, without changing the name.</p>
]]>
</Details>
@@ -3825,11 +3860,24 @@
<Details>
<![CDATA[
<p>This field, although defined as a simple variable (int, String, etc) only has a set of constant values
- assigned to it. This appears to be used like an enum value, and should probably be defined as such.
+ assigned to it. Thus it appears to be used like an enum value, and should probably be defined as such.
</p>
]]>
</Details>
</BugPattern>
+
+ <BugPattern type="UP_UNUSED_PARAMETER">
+ <ShortDescription>Static or private method has unused parameters</ShortDescription>
+ <LongDescription>Static or private method {1} has unused parameters</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method defines parameters that are never used. As this method is either static of private,
+ and can't be derived from, it is safe to remove these parameters and simplify your method.
+ You should consider, while unlikely, that this method may be used reflectively, and thus you will
+ want to change that call as well.
+ ]]>
+ </Details>
+ </BugPattern>
<!-- BugCode -->
@@ -3947,4 +3995,5 @@
<BugCode abbrev="ICA">Invalid Constant Argument</BugCode>
<BugCode abbrev="CNC">Collection Naming Confusion</BugCode>
<BugCode abbrev="PME">Poor Mans Enum</BugCode>
+ <BugCode abbrev="UP">Unused Parameter</BugCode>
</MessageCollection>
Modified: trunk/fb-contrib/htdocs/index.shtml
===================================================================
--- trunk/fb-contrib/htdocs/index.shtml 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/htdocs/index.shtml 2014-02-17 21:22:53 UTC (rev 1765)
@@ -68,14 +68,14 @@
</li>
</ul>
</p>
- <p style="font-weight: bold;">The latest version of fb-contrib is 5.0.2 available for download
- <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-5.0.2.jar/download">here</a>.</p>
+ <p style="font-weight: bold;">The latest version of fb-contrib is 5.0.3 available for download
+ <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-5.0.3.jar/download">here</a>.</p>
</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>[STB] Stacked Try Blocks</b><br/>
Looks for two or more try catch blocks that are consecutive and catch the
@@ -106,12 +106,16 @@
Looks for simple fields that only store one of several constant values. This usually is an indication
that this field should really be an enum type.
</li>
+ <li><b>[UP] Unused Parameter</b><br/>
+ Looks for private or static methods that have parameters that aren't used. These parameters
+ can be removed.
+ </li>
</ul>
</div>
<hr/>
- <img id="v5_0_0_image" src="flip2.gif" onClick="toggleBlock('v5_0_0', 'v5_0_0_image');" align="top"/>
+ <img id="v5_0_0_image" src="flip1.gif" onClick="toggleBlock('v5_0_0', 'v5_0_0_image');" align="top"/>
Detectors added in v5.0.0<br/>
- <div id="v5_0_0" style="display:block;">
+ <div id="v5_0_0" style="display:none;">
<li><b>[CVAA] ContraVariant Array Assignment</b><br/>
Looks for contravariant array assignments. Since arrays are mutable data structures, their use
must be restricted to covariant or invariant usage.<br/>
Modified: trunk/fb-contrib/htdocs/repository.html
===================================================================
--- trunk/fb-contrib/htdocs/repository.html 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/htdocs/repository.html 2014-02-17 21:22:53 UTC (rev 1765)
@@ -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>5.0.2</td></tr>
+ <tr><td><b>Version:</b></td><td>5.0.3</td></tr>
</table>
</div>
Modified: trunk/fb-contrib/pom.xml
===================================================================
--- trunk/fb-contrib/pom.xml 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/pom.xml 2014-02-17 21:22:53 UTC (rev 1765)
@@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
- <version>5.0.2</version>
+ <version>5.0.3</version>
<parent>
<groupId>org.sonatype.oss</groupId>
Modified: trunk/fb-contrib/samples/ABC_Sample.java
===================================================================
--- trunk/fb-contrib/samples/ABC_Sample.java 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/samples/ABC_Sample.java 2014-02-17 21:22:53 UTC (rev 1765)
@@ -6,46 +6,36 @@
import java.util.Set;
import java.util.TreeMap;
+public class ABC_Sample {
+ public Map<String[], String> testMaps(String[] key, String value) {
+ Map<String[], String> m = new HashMap<String[], String>();
+ m.put(key, value);
+ return m;
+ }
+ public Set<String[]> testSets(String[] values) {
+ Set<String[]> s = new HashSet<String[]>();
+ s.add(values);
+ return s;
+ }
-public class ABC_Sample
-{
- public Map<String[], String> testMaps(String[] key, String value)
- {
- Map<String[], String> m = new HashMap<String[], String>();
- m.put(key, value);
- return m;
- }
-
- public Set<String[]> testSets(String[] values)
- {
- Set<String[]> s = new HashSet<String[]>();
- s.add(values);
- return s;
- }
-
- public boolean testLists(List<String[]> l, String[] value)
- {
- return l.contains(value);
- }
-
- public static class UseComparator
- {
- private Map<byte[], byte[]> testComp;
-
- public UseComparator()
- {
- testComp = new TreeMap<byte[], byte[]>( new Comparator<byte[]>()
- {
- public int compare(byte[] b1, byte[] b2)
- {
- return b1.length - b2.length;
- }
- });
- }
-
- public void testc() {
- testComp.put(new byte[5], new byte[3]);
- }
- }
+ public boolean testLists(List<String[]> l, String[] value) {
+ return l.contains(value);
+ }
+
+ public static class UseComparator {
+ private Map<byte[], byte[]> testComp;
+
+ public UseComparator() {
+ testComp = new TreeMap<byte[], byte[]>(new Comparator<byte[]>() {
+ public int compare(byte[] b1, byte[] b2) {
+ return b1.length - b2.length;
+ }
+ });
+ }
+
+ public void testc() {
+ testComp.put(new byte[5], new byte[3]);
+ }
+ }
}
Modified: trunk/fb-contrib/samples/ACEM_Sample.java
===================================================================
--- trunk/fb-contrib/samples/ACEM_Sample.java 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/samples/ACEM_Sample.java 2014-02-17 21:22:53 UTC (rev 1765)
@@ -1,13 +1,9 @@
+public abstract class ACEM_Sample {
+ public void test() {
+ }
-public abstract class ACEM_Sample
-{
- public void test()
- {
- }
-
- public int test1()
- {
- throw new UnsupportedOperationException("Not implemented");
- }
+ public int test1() {
+ throw new UnsupportedOperationException("Not implemented");
+ }
}
\ No newline at end of file
Modified: trunk/fb-contrib/samples/AFBR_Sample.java
===================================================================
--- trunk/fb-contrib/samples/AFBR_Sample.java 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/samples/AFBR_Sample.java 2014-02-17 21:22:53 UTC (rev 1765)
@@ -3,80 +3,55 @@
import java.io.InputStream;
@SuppressWarnings("all")
-public class AFBR_Sample
-{
- public int test1(boolean b)
- {
- try
- {
- int i = 0;
- }
- finally
- {
- if (b)
- return 0;
- int j = 0;
- }
- return 2;
- }
-
- public int test2()
- {
- try
- {
- return 0;
- }
- finally
- {
- throw new NullPointerException();
- }
- }
-
- public int test3() throws Exception
- {
- try
- {
- return 0;
- }
- finally
- {
- throw new Exception();
- }
- }
-
- public int test4()
- {
- try
- {
- throw new Exception();
- }
- catch (Exception e)
- {
- return 1;
- }
- finally
- {
- return 0;
- }
- }
-
- public int test5() throws IOException
- {
- InputStream is = null;
- try
- {
- is = new FileInputStream("test");
- return 1;
- }
- catch (IOException ioe)
- {
- System.out.println("error");
- }
- finally
- {
- if (is != null)
- is.close();
- }
- return 0;
- }
+public class AFBR_Sample {
+ public int test1(boolean b) {
+ try {
+ int i = 0;
+ } finally {
+ if (b)
+ return 0;
+ int j = 0;
+ }
+ return 2;
+ }
+
+ public int test2() {
+ try {
+ return 0;
+ } finally {
+ throw new NullPointerException();
+ }
+ }
+
+ public int test3() throws Exception {
+ try {
+ return 0;
+ } finally {
+ throw new Exception();
+ }
+ }
+
+ public int test4() {
+ try {
+ throw new Exception();
+ } catch (Exception e) {
+ return 1;
+ } finally {
+ return 0;
+ }
+ }
+
+ public int test5() throws IOException {
+ InputStream is = null;
+ try {
+ is = new FileInputStream("test");
+ return 1;
+ } catch (IOException ioe) {
+ System.out.println("error");
+ } finally {
+ if (is != null)
+ is.close();
+ }
+ return 0;
+ }
}
\ No newline at end of file
Modified: trunk/fb-contrib/samples/AIOB_Sample.java
===================================================================
--- trunk/fb-contrib/samples/AIOB_Sample.java 2014-01-15 20:53:03 UTC (rev 1764)
+++ trunk/fb-contrib/samples/AIOB_Sample.java 2014-02-17 21:22:53 UTC (rev 1765)
@@ -1,62 +1,58 @@
import java.util.List;
-
-public class AIOB_Sample
-{
+public class AIOB_Sample {
int[] fa = new int[4];
int[] fb;
-
- public void testOutOfBounds()
- {
+
+ public void testOutOfBounds() {
int[] a = new int[4];
-
+
a[4] = 2;
fa[4] = 2;
}
-
- public void testUnallocated()
- {
+
+ public void testUnallocated() {
int[] b = null;
-
+
b[4] = 4;
fb[4] = 4;
}
-
+
public int[] fpPlusPlusNotRecognized(List<String> l) {
int size = 0;
-
+
for (String s : l) {
size++;
}
-
+
int[] data = new int[size];
-
+
data[0] = 0;
return data;
}
-
+
public void fpPostAllocate() {
double[] da = null;
-
+
for (int i = 0; i < 10; i++) {
if ((i & 1) == 1) {
da[0] = 0.0;
}
-
+
if (da == null)
da = new double[10];
}
}
-
+
public void fpPlusEquals(List<String> ss) {
...
[truncated message content] |