Update of /cvsroot/fb-contrib/fb-contrib/etc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11646/etc
Modified Files:
findbugs.xml messages.xml
Log Message:
initial checkin, NAB detector
Index: messages.xml
===================================================================
RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- messages.xml 1 Dec 2005 05:28:42 -0000 1.33
+++ messages.xml 3 Dec 2005 03:33:24 -0000 1.34
@@ -283,6 +283,27 @@
</Details>
</Detector>
+ <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:
+ <ul>
+ <li>new Boolean(Boolean)</li>
+ <li>new Byte(Byte)</li>
+ <li>new Character(Character)</li>
+ <li>new Short(Short)</li>
+ <li>new Integer(Integer)</li>
+ <li>new Long(Long)</li>
+ <li>new Float(Float)</li>
+ <li>new Double(Double)</li>
+ </ul>
+ </p>
+ <p>It is a fast detector</p>
+ ]]>
+ </Details>
+ </Detector>
+
<!-- BugPattern -->
<BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING">
@@ -544,7 +565,20 @@
]]>
</Details>
</BugPattern>
-
+
+ <BugPattern type="NAB_NEEDLESS_AUTOBOXING">
+ <ShortDescription>method passes primitive wrapper to same primitive wrapper constructor</ShortDescription>
+ <LongDescription>method {1} passes primitive wrapper to same primitive wrapper constructor</LongDescription>
+ <Details>
+ <![CDATA[
+ <p>This method passes a wrapped primitive object to the same class's constructor.
+ Since wrapper classes are immutable, you can just use the original object, rather
+ than constructing a new one. This code works because of an abuse of autoboxing.
+ </p>
+ ]]>
+ </Details>
+ </BugPattern>
+
<!-- BugCode -->
<BugCode abbrev="ISB">Inefficient String Buffering</BugCode>
@@ -568,4 +602,5 @@
<BugCode abbrev="AFBR">Abnormal Finally Block Return</BugCode>
<BugCode abbrev="SMII">Static Method Instance Invocation</BugCode>
<BugCode abbrev="STS">Spurious Thread States</BugCode>
+ <BugCode abbrev="NAB">Needless Autoboxing</BugCode>
</MessageCollection>
\ No newline at end of file
Index: findbugs.xml
===================================================================
RCS file: /cvsroot/fb-contrib/fb-contrib/etc/findbugs.xml,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- findbugs.xml 1 Dec 2005 05:30:15 -0000 1.40
+++ findbugs.xml 3 Dec 2005 03:33:24 -0000 1.41
@@ -97,6 +97,10 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.SpuriousThreadStates"
speed="fast"
reports="STS_SPURIOUS_THREAD_STATES" />
+
+ <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessAutoboxing"
+ speed="fast"
+ reports="NAB_NEEDLESS_AUTOBOXING" />
<!-- BugPattern -->
@@ -121,5 +125,5 @@
<BugPattern abbrev="AFBR" type="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" category="CORRECTNESS" />
<BugPattern abbrev="SMII" type="SMII_STATIC_METHOD_INSTANCE_INVOCATION" category="STYLE" />
<BugPattern abbrev="STS" type="STS_SPURIOUS_THREAD_STATES" category="MT_CORRECTNESS" experimental="true" />
-
+ <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING" category="PERFORMANCE" experimental="true" />
</FindbugsPlugin>
\ No newline at end of file
|