[Fb-contrib-commit] SF.net SVN: fb-contrib:[1716] trunk/fb-contrib
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.
|