fb-contrib-commit Mailing List for fb-contrib (Page 63)
Brought to you by:
dbrosius
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(56) |
Oct
(60) |
Nov
(58) |
Dec
(89) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(66) |
Feb
(55) |
Mar
(85) |
Apr
(115) |
May
(35) |
Jun
(28) |
Jul
(3) |
Aug
(48) |
Sep
(37) |
Oct
(22) |
Nov
(14) |
Dec
(66) |
2007 |
Jan
(45) |
Feb
(63) |
Mar
(10) |
Apr
(1) |
May
(1) |
Jun
(12) |
Jul
|
Aug
|
Sep
(25) |
Oct
(21) |
Nov
(39) |
Dec
|
2008 |
Jan
(7) |
Feb
|
Mar
(26) |
Apr
(5) |
May
(2) |
Jun
(32) |
Jul
(9) |
Aug
(10) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
|
2009 |
Jan
(10) |
Feb
(31) |
Mar
(32) |
Apr
(35) |
May
(25) |
Jun
|
Jul
(31) |
Aug
(10) |
Sep
(95) |
Oct
(35) |
Nov
(10) |
Dec
(34) |
2010 |
Jan
(90) |
Feb
(4) |
Mar
(7) |
Apr
(20) |
May
(20) |
Jun
(13) |
Jul
(7) |
Aug
(18) |
Sep
(25) |
Oct
(4) |
Nov
(16) |
Dec
(2) |
2011 |
Jan
(1) |
Feb
|
Mar
(11) |
Apr
(3) |
May
(2) |
Jun
(26) |
Jul
(10) |
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(14) |
Nov
(3) |
Dec
(4) |
2013 |
Jan
(3) |
Feb
(2) |
Mar
(1) |
Apr
(4) |
May
|
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
(4) |
Nov
(3) |
Dec
(3) |
2014 |
Jan
(4) |
Feb
(2) |
Mar
(4) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(3) |
Dec
(3) |
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
(2) |
Nov
(7) |
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
(5) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(3) |
2018 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(5) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Dave B. <dbr...@us...> - 2006-02-18 03:07:22
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8307/etc Modified Files: findbugs.xml Log Message: hide CE and BSB Index: findbugs.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/findbugs.xml,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- findbugs.xml 18 Feb 2006 03:03:41 -0000 1.60 +++ findbugs.xml 18 Feb 2006 03:07:19 -0000 1.61 @@ -44,7 +44,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="moderate" reports="CE_CLASS_ENVY" - disabled="true" /> + hidden="true" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="moderate" @@ -129,7 +129,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" - disabled="true" /> + hidden="true" /> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" |
From: Dave B. <dbr...@us...> - 2006-02-18 03:03:49
|
Update of /cvsroot/fb-contrib/fb-contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6605 Modified Files: build.xml Log Message: get ready for the 2.2.0 release Index: build.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/build.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- build.xml 4 Feb 2006 21:30:25 -0000 1.27 +++ build.xml 18 Feb 2006 03:03:41 -0000 1.28 @@ -18,7 +18,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="2.1.0"/> + <property name="fb-contrib.version" value="2.2.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> |
From: Dave B. <dbr...@us...> - 2006-02-18 03:03:48
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6605/htdocs Modified Files: index.html Log Message: get ready for the 2.2.0 release Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.63 retrieving revision 1.64 diff -u -d -r1.63 -r1.64 --- index.html 6 Feb 2006 02:10:58 -0000 1.63 +++ index.html 18 Feb 2006 03:03:41 -0000 1.64 @@ -46,16 +46,24 @@ <a href="javadoc/index.html">JavaDoc</a> <hr/> - <img id="cvs_image" src="flip2.gif" onClick="toggleBlock('cvs', 'cvs_image');" align="top"/> + <img id="cvs_image" src="flip1.gif" onClick="toggleBlock('cvs', 'cvs_image');" align="top"/> Detectors added in CVS<br/> Note: these detectors are still in testing<br/> - Note: fb-contrib v2.2.0 requires FindBugs™ v0.95 or later<br/> - <div id="cvs" style="display:block;"> + <div id="cvs" style="display:none;"> <ul> <li><b>Bloated Synchronized Block</b><br/> Looks for methods that implement synchronized blocks that appear to contain some code at the beginning that does not need to be synchronized. Moving these lines out of the synchronized block should help multithreaded performance.</li> + </ul> + </div> + + <hr/> + <img id="v2_2_0_image" src="flip2.gif" onClick="toggleBlock('v2_2_0', 'v2_2_0_image');" align="top"/> + Detectors added in 2.2.0<br/> + Note: fb-contrib v2.2.0 requires FindBugs™ v0.95 or later<br/> + <div id="v2_2_0" style="display:block;"> + <ul> <li><b>Constant List Index</b><br/> Looks for methods that access an array or list using a constant integer index. Often, this is a typo where a loop variable is intended to be used. If however, specific |
From: Dave B. <dbr...@us...> - 2006-02-18 03:03:47
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6605/etc Modified Files: findbugs.xml Log Message: get ready for the 2.2.0 release Index: findbugs.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/findbugs.xml,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- findbugs.xml 4 Feb 2006 02:23:50 -0000 1.59 +++ findbugs.xml 18 Feb 2006 03:03:41 -0000 1.60 @@ -128,7 +128,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" - reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" /> + reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" + disabled="true" /> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" |
From: Dave B. <dbr...@us...> - 2006-02-12 03:48:03
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27473/src/com/mebigfatguy/fbcontrib/detect Modified Files: SloppyClassReflection.java Log Message: clear state back to SEEN_NOTHING if LDC isn't immediately followed by the forName call Index: SloppyClassReflection.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SloppyClassReflection.java 6 Feb 2006 01:36:23 -0000 1.2 +++ SloppyClassReflection.java 12 Feb 2006 03:47:53 -0000 1.3 @@ -164,8 +164,8 @@ .addMethod(this) .addSourceLine(this)); } - } + state = SEEN_NOTHING; break; } } |
From: Dave B. <dbr...@us...> - 2006-02-06 02:11:06
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18752/htdocs Modified Files: index.html Log Message: more of same Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.62 retrieving revision 1.63 diff -u -d -r1.62 -r1.63 --- index.html 6 Feb 2006 02:08:04 -0000 1.62 +++ index.html 6 Feb 2006 02:10:58 -0000 1.63 @@ -42,7 +42,7 @@ own. </p> <a href="http://www.sourceforge.net/projects/fb-contrib">Project Page</a> - <img src="vbar.gif"/> + <img src="vbar.gif" height="12"/> <a href="javadoc/index.html">JavaDoc</a> <hr/> |
From: Dave B. <dbr...@us...> - 2006-02-06 02:08:12
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17820/htdocs Modified Files: index.html Added Files: vbar.gif Log Message: 'pretty' it up Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- index.html 6 Feb 2006 01:51:26 -0000 1.61 +++ index.html 6 Feb 2006 02:08:04 -0000 1.62 @@ -42,6 +42,7 @@ own. </p> <a href="http://www.sourceforge.net/projects/fb-contrib">Project Page</a> + <img src="vbar.gif"/> <a href="javadoc/index.html">JavaDoc</a> <hr/> --- NEW FILE: vbar.gif --- (This appears to be a binary file; contents omitted.) |
From: Dave B. <dbr...@us...> - 2006-02-06 01:51:34
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12009/htdocs Modified Files: index.html Log Message: add javadoc to web site Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.60 retrieving revision 1.61 diff -u -d -r1.60 -r1.61 --- index.html 4 Feb 2006 02:26:03 -0000 1.60 +++ index.html 6 Feb 2006 01:51:26 -0000 1.61 @@ -42,6 +42,7 @@ own. </p> <a href="http://www.sourceforge.net/projects/fb-contrib">Project Page</a> + <a href="javadoc/index.html">JavaDoc</a> <hr/> <img id="cvs_image" src="flip2.gif" onClick="toggleBlock('cvs', 'cvs_image');" align="top"/> |
From: Dave B. <dbr...@us...> - 2006-02-06 01:39:38
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7866/src/com/mebigfatguy/fbcontrib/detect Modified Files: SluggishGui.java Log Message: javadoc Index: SluggishGui.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- SluggishGui.java 6 Feb 2006 01:36:23 -0000 1.5 +++ SluggishGui.java 6 Feb 2006 01:39:26 -0000 1.6 @@ -106,7 +106,7 @@ /** * overrides the visitor to reset look for gui interfaces * - * @param obj the context object for the currently parsed class + * @param classContext the context object for the currently parsed class */ @Override public void visitClassContext(ClassContext classContext) { @@ -135,7 +135,7 @@ /** * overrides the visitor to visit all of the collected listener methods * - * @parm obj the context object of the currently parsed class + * @param obj the context object of the currently parsed class */ @Override public void visitAfter(JavaClass obj) { |
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6903/src/com/mebigfatguy/fbcontrib/detect Modified Files: ArrayBasedCollections.java ArrayWrappedCallByReference.java BloatedSynchronizedBlock.java ConfusingAutoboxedOverloading.java ConstantListIndex.java CopiedOverriddenMethod.java CustomBuiltXML.java CyclomaticComplexity.java DeclaredRuntimeException.java DubiousListCollection.java FinalParameters.java FloatingPointLoops.java InefficientStringBuffering.java ListIndexedIterating.java LiteralStringComparison.java ManualArrayCopy.java NeedlessAutoboxing.java NeedlessInstanceRetrieval.java NonCollectionMethodUse.java OrphanedDOMNode.java OverlyConcreteParameter.java ParallelLists.java PartiallyConstructedObjectAccess.java SloppyClassReflection.java SluggishGui.java SpuriousThreadStates.java StaticMethodInstanceInvocation.java SyncCollectionIterators.java UnnecessaryStoreBeforeReturn.java UnrelatedCollectionContents.java Log Message: javadoc Index: NonCollectionMethodUse.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- NonCollectionMethodUse.java 4 Jan 2006 02:40:42 -0000 1.4 +++ NonCollectionMethodUse.java 6 Feb 2006 01:36:23 -0000 1.5 @@ -26,6 +26,10 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; +/** + * 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. + */ public class NonCollectionMethodUse extends BytecodeScanningDetector implements StatelessDetector { private static Set<String> oldMethods = new HashSet<String>(); Index: BloatedSynchronizedBlock.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- BloatedSynchronizedBlock.java 1 Feb 2006 06:47:47 -0000 1.15 +++ BloatedSynchronizedBlock.java 6 Feb 2006 01:36:22 -0000 1.16 @@ -32,6 +32,11 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.StatelessDetector; +/** + * looks for methods that are implemented using synchronized blocks, but are overly + * synchronized because the beginning of the block only accesses local variables, + * and not member variables, or this. + */ public class BloatedSynchronizedBlock extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; Index: NeedlessAutoboxing.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- NeedlessAutoboxing.java 4 Feb 2006 01:23:06 -0000 1.6 +++ NeedlessAutoboxing.java 6 Feb 2006 01:36:23 -0000 1.7 @@ -28,6 +28,10 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; +/** + * Looks for methods that pass a primitive wrapper class object, to the + * same classes Constructor. + */ public class NeedlessAutoboxing extends BytecodeScanningDetector implements StatelessDetector { private static final int SEEN_NOTHING = 0; Index: CopiedOverriddenMethod.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CopiedOverriddenMethod.java 17 Jan 2006 04:41:21 -0000 1.6 +++ CopiedOverriddenMethod.java 6 Feb 2006 01:36:22 -0000 1.7 @@ -38,6 +38,9 @@ import edu.umd.cs.findbugs.ba.ClassContext; import edu.umd.cs.findbugs.visitclass.DismantleBytecode; +/** + * Looks for methods that are direct copies of the implementation in the super class + */ public class CopiedOverriddenMethod extends DismantleBytecode implements Detector, StatelessDetector { private BugReporter bugReporter; Index: ArrayWrappedCallByReference.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ArrayWrappedCallByReference.java 31 Jan 2006 02:14:26 -0000 1.4 +++ ArrayWrappedCallByReference.java 6 Feb 2006 01:36:22 -0000 1.5 @@ -31,7 +31,7 @@ import edu.umd.cs.findbugs.StatelessDetector; /** - * Looks for methods that use an array of length one to pass a variable to achieve call + * looks for methods that use an array of length one to pass a variable to achieve call * by pointer ala C++. It is better to define a proper return class type that holds all * the relevant information retrieved from the called method. */ Index: ConfusingAutoboxedOverloading.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ConfusingAutoboxedOverloading.java 4 Jan 2006 02:40:42 -0000 1.7 +++ ConfusingAutoboxedOverloading.java 6 Feb 2006 01:36:22 -0000 1.8 @@ -34,6 +34,19 @@ import edu.umd.cs.findbugs.ba.ClassContext; import edu.umd.cs.findbugs.visitclass.PreorderVisitor; +/** + * 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') + * </pre> + * would map to + * <pre> + * public void test(Character c) + * </pre> + * but instead maps to one that takes an int long, float or double. + */ public class ConfusingAutoboxedOverloading extends PreorderVisitor implements Detector, StatelessDetector { private static final int JDK15_MAJOR = 49; Index: ParallelLists.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ParallelLists.java 31 Jan 2006 02:14:26 -0000 1.9 +++ ParallelLists.java 6 Feb 2006 01:36:23 -0000 1.10 @@ -35,6 +35,11 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * 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. + */ public class ParallelLists extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; Index: SluggishGui.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SluggishGui.java 3 Feb 2006 03:45:20 -0000 1.4 +++ SluggishGui.java 6 Feb 2006 01:36:23 -0000 1.5 @@ -33,6 +33,13 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * 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. + */ public class SluggishGui extends BytecodeScanningDetector implements StatelessDetector { private static final Set<String> expensiveCalls = new HashSet<String>(); Index: PartiallyConstructedObjectAccess.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- PartiallyConstructedObjectAccess.java 31 Jan 2006 02:14:26 -0000 1.6 +++ PartiallyConstructedObjectAccess.java 6 Feb 2006 01:36:23 -0000 1.7 @@ -30,6 +30,11 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * 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. + */ public class PartiallyConstructedObjectAccess extends BytecodeScanningDetector { private BugReporter bugReporter; Index: SpuriousThreadStates.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- SpuriousThreadStates.java 31 Jan 2006 02:14:26 -0000 1.7 +++ SpuriousThreadStates.java 6 Feb 2006 01:36:23 -0000 1.8 @@ -27,6 +27,13 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.StatelessDetector; +/** + * 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 + * when not intended, or removing the the thread from the runnable state. + */ public class SpuriousThreadStates extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; Index: DubiousListCollection.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- DubiousListCollection.java 31 Jan 2006 02:14:26 -0000 1.11 +++ DubiousListCollection.java 6 Feb 2006 01:36:23 -0000 1.12 @@ -36,6 +36,11 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * 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. + */ public class DubiousListCollection extends BytecodeScanningDetector { private static final Integer FIELD_UNKNOWN = new Integer(0); Index: FinalParameters.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- FinalParameters.java 4 Jan 2006 02:40:42 -0000 1.11 +++ FinalParameters.java 6 Feb 2006 01:36:23 -0000 1.12 @@ -43,6 +43,11 @@ import edu.umd.cs.findbugs.ba.SourceFile; import edu.umd.cs.findbugs.ba.SourceFinder; +/** + * 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 + * as final. + */ public class FinalParameters extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; Index: ArrayBasedCollections.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ArrayBasedCollections.java 31 Jan 2006 02:14:26 -0000 1.5 +++ ArrayBasedCollections.java 6 Feb 2006 01:36:22 -0000 1.6 @@ -32,7 +32,7 @@ import edu.umd.cs.findbugs.ba.ClassContext; /** - * Looks for methods that use arrays for items in the keyset of a map, or as + * looks for methods that use arrays for items in the keyset of a map, or as * an element of a set, or in a list when using the contains method. Since arrays * do not, and cannot define an equals method, reference equality is used for these * collections, which is probably not desired. Index: UnnecessaryStoreBeforeReturn.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- UnnecessaryStoreBeforeReturn.java 4 Jan 2006 02:40:42 -0000 1.6 +++ UnnecessaryStoreBeforeReturn.java 6 Feb 2006 01:36:23 -0000 1.7 @@ -28,6 +28,10 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; +/** + * Looks for methods that store the return result in a local variable, and + * then immediately returns that local variable. + */ public class UnnecessaryStoreBeforeReturn extends BytecodeScanningDetector implements StatelessDetector { private static final int SEEN_NOTHING = 0; Index: FloatingPointLoops.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- FloatingPointLoops.java 4 Jan 2006 02:40:42 -0000 1.8 +++ FloatingPointLoops.java 6 Feb 2006 01:36:23 -0000 1.9 @@ -30,6 +30,12 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; +/** + * 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. + */ public class FloatingPointLoops extends BytecodeScanningDetector implements StatelessDetector { private static final int SEEN_LOAD = 1; Index: OrphanedDOMNode.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- OrphanedDOMNode.java 31 Jan 2006 02:14:26 -0000 1.5 +++ OrphanedDOMNode.java 6 Feb 2006 01:36:23 -0000 1.6 @@ -32,6 +32,9 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.StatelessDetector; +/** + * Looks for methods that create DOM Nodes but do not add them to any DOM Document. + */ public class OrphanedDOMNode extends BytecodeScanningDetector implements StatelessDetector { private static final Set<String> domCreationMethods = new HashSet<String>(); Index: SloppyClassReflection.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SloppyClassReflection.java 20 Jan 2006 06:58:08 -0000 1.1 +++ SloppyClassReflection.java 6 Feb 2006 01:36:23 -0000 1.2 @@ -23,7 +23,6 @@ import org.apache.bcel.classfile.Constant; import org.apache.bcel.classfile.ConstantString; -import org.apache.bcel.classfile.ConstantUtf8; import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.LocalVariable; import org.apache.bcel.classfile.LocalVariableTable; @@ -36,6 +35,13 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * looks for methods that use Class.forName("XXX") to load a class object + * for a class that is already referenced by this class. It is simpler to just use + * XXX.class, and doing so protects the integrity of this code from such transformations + * as obfuscation. Use of Class.forName should only be used when the class in question + * isn't already statically bound to this context. + */ public class SloppyClassReflection extends BytecodeScanningDetector implements StatelessDetector { private static final int COLLECT = -1; private static final int SEEN_NOTHING = 0; Index: ListIndexedIterating.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ListIndexedIterating.java 31 Jan 2006 02:14:26 -0000 1.12 +++ ListIndexedIterating.java 6 Feb 2006 01:36:23 -0000 1.13 @@ -31,6 +31,11 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.StatelessDetector; +/** + * 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. + */ public class ListIndexedIterating extends BytecodeScanningDetector implements StatelessDetector { private static final int SEEN_NOTHING = 0; Index: SyncCollectionIterators.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- SyncCollectionIterators.java 31 Jan 2006 02:14:26 -0000 1.11 +++ SyncCollectionIterators.java 6 Feb 2006 01:36:23 -0000 1.12 @@ -35,6 +35,12 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * Looks for use of iterators on synchronized collections built from the Collections class. + * 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. + */ public class SyncCollectionIterators extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; Index: LiteralStringComparison.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- LiteralStringComparison.java 31 Jan 2006 02:14:26 -0000 1.8 +++ LiteralStringComparison.java 6 Feb 2006 01:36:23 -0000 1.9 @@ -25,6 +25,11 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.OpcodeStack; +/** + * 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. + */ public class LiteralStringComparison extends BytecodeScanningDetector { private BugReporter bugReporter; Index: OverlyConcreteParameter.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- OverlyConcreteParameter.java 31 Jan 2006 02:14:26 -0000 1.27 +++ OverlyConcreteParameter.java 6 Feb 2006 01:36:23 -0000 1.28 @@ -42,6 +42,11 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * 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, + * and makes low impact changes more difficult. + */ public class OverlyConcreteParameter extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; Index: DeclaredRuntimeException.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- DeclaredRuntimeException.java 4 Jan 2006 02:40:42 -0000 1.9 +++ DeclaredRuntimeException.java 6 Feb 2006 01:36:23 -0000 1.10 @@ -34,6 +34,12 @@ import edu.umd.cs.findbugs.ba.ClassContext; import edu.umd.cs.findbugs.visitclass.PreorderVisitor; +/** + * 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. + */ public class DeclaredRuntimeException extends PreorderVisitor implements Detector, StatelessDetector { private BugReporter bugReporter; Index: UnrelatedCollectionContents.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- UnrelatedCollectionContents.java 31 Jan 2006 02:14:26 -0000 1.12 +++ UnrelatedCollectionContents.java 6 Feb 2006 01:36:23 -0000 1.13 @@ -38,6 +38,14 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * 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, + * 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 + * collection, or array. + */ public class UnrelatedCollectionContents extends BytecodeScanningDetector implements StatelessDetector { private static final Set<String> COLLECTION_CLASSES = new HashSet<String>(); Index: CustomBuiltXML.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- CustomBuiltXML.java 31 Jan 2006 02:14:26 -0000 1.7 +++ CustomBuiltXML.java 6 Feb 2006 01:36:22 -0000 1.8 @@ -31,6 +31,12 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.StatelessDetector; +/** + * 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 + * transformed at runtime, using parameters set through Transformer.setParameter. + */ public class CustomBuiltXML extends BytecodeScanningDetector implements StatelessDetector { private static final Map<Pattern, Boolean> xmlPatterns = new HashMap<Pattern, Boolean>(); Index: ConstantListIndex.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ConstantListIndex.java 18 Jan 2006 03:23:52 -0000 1.7 +++ ConstantListIndex.java 6 Feb 2006 01:36:22 -0000 1.8 @@ -31,6 +31,12 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; +/** + * 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 + * variable, but if specific indices mean certain things, perhaps a first class object + * would be a better choice for a container. + */ public class ConstantListIndex extends BytecodeScanningDetector implements StatelessDetector { private static final String MAX_ICONST0_LOOP_DISTANCE_PROPERTY = "fb-contrib.cli.maxloopdistance"; private static final int SEEN_NOTHING = 0; Index: CyclomaticComplexity.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- CyclomaticComplexity.java 4 Jan 2006 02:40:42 -0000 1.9 +++ CyclomaticComplexity.java 6 Feb 2006 01:36:23 -0000 1.10 @@ -36,6 +36,10 @@ import edu.umd.cs.findbugs.ba.EdgeTypes; import edu.umd.cs.findbugs.visitclass.PreorderVisitor; +/** + * 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'. + */ public class CyclomaticComplexity extends PreorderVisitor implements Detector, StatelessDetector { public static final String LIMIT_PROPERTY = "fb-contrib.cc.limit"; Index: StaticMethodInstanceInvocation.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- StaticMethodInstanceInvocation.java 31 Jan 2006 02:14:26 -0000 1.6 +++ StaticMethodInstanceInvocation.java 6 Feb 2006 01:36:23 -0000 1.7 @@ -32,6 +32,11 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.OpcodeStack; +/** + * 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. + */ public class StaticMethodInstanceInvocation extends BytecodeScanningDetector { private BugReporter bugReporter; private OpcodeStack stack = new OpcodeStack(); @@ -55,6 +60,11 @@ return super.clone(); } + /** + * implement the visitor to reset the stack + * + * @param obj the context object of the currently parsed method + */ @Override public void visitMethod(Method obj) { stack.resetForMethodEntry(this); @@ -62,6 +72,11 @@ super.visitMethod(obj); } + /** + * implements the visitor to look for static method calls from instance variables + * + * @param seen the opcode of the currently visited instruction + */ @Override public void sawOpcode(int seen) { try { Index: NeedlessInstanceRetrieval.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- NeedlessInstanceRetrieval.java 6 Feb 2006 00:00:29 -0000 1.6 +++ NeedlessInstanceRetrieval.java 6 Feb 2006 01:36:23 -0000 1.7 @@ -27,6 +27,11 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; +/** + * looks for methods that call a method to retrieve a reference to an object, + * to use to load a constant. It is simpler and more performant to access the + * static variable directly from the class itself. + */ public class NeedlessInstanceRetrieval extends BytecodeScanningDetector implements StatelessDetector { private static final int SEEN_NOTHING = 0; private static final int SEEN_INVOKE = 1; Index: ManualArrayCopy.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ManualArrayCopy.java 4 Jan 2006 02:40:42 -0000 1.4 +++ ManualArrayCopy.java 6 Feb 2006 01:36:23 -0000 1.5 @@ -25,6 +25,10 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; +/** + * 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. + */ public class ManualArrayCopy extends BytecodeScanningDetector implements StatelessDetector { public static final int SEEN_NOTHING = 0; Index: InefficientStringBuffering.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- InefficientStringBuffering.java 31 Jan 2006 02:14:26 -0000 1.8 +++ InefficientStringBuffering.java 6 Feb 2006 01:36:23 -0000 1.9 @@ -27,6 +27,9 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.OpcodeStack.Item; +/** + * looks for appending strings inside of calls to StringBuffer or StringBuilder append. + */ public class InefficientStringBuffering extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; |
From: Dave B. <dbr...@us...> - 2006-02-06 01:21:58
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1667/etc Modified Files: messages.xml Log Message: Fix FP description Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- messages.xml 4 Feb 2006 02:23:50 -0000 1.53 +++ messages.xml 6 Feb 2006 01:21:49 -0000 1.54 @@ -159,10 +159,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.FinalParameters"> <Details> <![CDATA[ - <p> Looks for classes that define fields that derive from java.util.List but are used to some extent - like a set class. Because set-type operations are performed using a linear search, performance is - going to be inferior to a Set class. If this List is going to remain very small, this may not - be a problem, but if the List may grow large, performance will suffer significantly.</p> + <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 + as final.</p> <p>It is a slow detector</p> ]]> </Details> |
From: Dave B. <dbr...@us...> - 2006-02-06 00:00:39
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29570/src/com/mebigfatguy/fbcontrib/detect Modified Files: NeedlessInstanceRetrieval.java Log Message: oi Index: NeedlessInstanceRetrieval.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- NeedlessInstanceRetrieval.java 5 Feb 2006 08:32:27 -0000 1.5 +++ NeedlessInstanceRetrieval.java 6 Feb 2006 00:00:29 -0000 1.6 @@ -19,7 +19,6 @@ package com.mebigfatguy.fbcontrib.detect; import org.apache.bcel.classfile.Code; -import org.apache.bcel.classfile.LineNumber; import org.apache.bcel.classfile.LineNumberTable; import org.apache.bcel.generic.Type; |
From: Dave B. <dbr...@us...> - 2006-02-05 08:32:35
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13160/src/com/mebigfatguy/fbcontrib/detect Modified Files: NeedlessInstanceRetrieval.java Log Message: ignore the string class as well, as .append is often a false positive Index: NeedlessInstanceRetrieval.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- NeedlessInstanceRetrieval.java 5 Feb 2006 08:10:33 -0000 1.4 +++ NeedlessInstanceRetrieval.java 5 Feb 2006 08:32:27 -0000 1.5 @@ -85,7 +85,9 @@ String sig = getSigConstantOperand(); Type retType = Type.getReturnType(sig); if (retType.getSignature().startsWith("L")) { - if (!"java/lang/Object".equals(getClassConstantOperand())) { + String clsName = getClassConstantOperand(); + if (!"java/lang/Object".equals(clsName) + && !"java/lang/String".equals(clsName)) { invokePC = getPC(); state = SEEN_INVOKE; } |
From: Dave B. <dbr...@us...> - 2006-02-05 08:10:41
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6070/src/com/mebigfatguy/fbcontrib/detect Modified Files: NeedlessInstanceRetrieval.java Log Message: the jdk generates lame code that follows this pattern using object.getClass() invokes followed by pops. So final member accesses fail. So ignore getClass calls. Index: NeedlessInstanceRetrieval.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- NeedlessInstanceRetrieval.java 5 Feb 2006 02:11:54 -0000 1.3 +++ NeedlessInstanceRetrieval.java 5 Feb 2006 08:10:33 -0000 1.4 @@ -85,8 +85,10 @@ String sig = getSigConstantOperand(); Type retType = Type.getReturnType(sig); if (retType.getSignature().startsWith("L")) { - invokePC = getPC(); - state = SEEN_INVOKE; + if (!"java/lang/Object".equals(getClassConstantOperand())) { + invokePC = getPC(); + state = SEEN_INVOKE; + } } } break; |
From: Dave B. <dbr...@us...> - 2006-02-05 02:12:05
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30591/src/com/mebigfatguy/fbcontrib/detect Modified Files: NeedlessInstanceRetrieval.java Log Message: use the linenumbertable to make sure that the load of the constant is at the same line as the method call, otherwise many false positives occur with invokes before for loops. Index: NeedlessInstanceRetrieval.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NeedlessInstanceRetrieval.java 5 Feb 2006 00:56:16 -0000 1.2 +++ NeedlessInstanceRetrieval.java 5 Feb 2006 02:11:54 -0000 1.3 @@ -18,7 +18,9 @@ */ package com.mebigfatguy.fbcontrib.detect; -import org.apache.bcel.classfile.Method; +import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.LineNumber; +import org.apache.bcel.classfile.LineNumberTable; import org.apache.bcel.generic.Type; import edu.umd.cs.findbugs.BugInstance; @@ -32,7 +34,9 @@ private static final int SEEN_POP = 2; private BugReporter bugReporter; + private LineNumberTable lnTable; private int state; + private int invokePC; /** * constructs a NIR detector given the reporter to report bugs on * @param bugReporter the sync of bug reports @@ -51,16 +55,20 @@ return super.clone(); } - /** - * overrides the interface to reset the state - * - * @param obj the context objeft of the currently parsed method - */ - @Override - public void visitMethod(Method obj) { - state = SEEN_NOTHING; - } - + /** + * overrides the interface to collect the line number table, and reset state + * + * @param obj the content object of the currently parsed code + */ + @Override + public void visitCode(Code obj) { + lnTable = obj.getLineNumberTable(); + if (lnTable != null) { + state = SEEN_NOTHING; + super.visitCode(obj); + } + } + /** * overrides the interface to find accesses of static variables off of an instance * immediately fetched from a method call. @@ -76,8 +84,10 @@ || (seen == INVOKEVIRTUAL)) { String sig = getSigConstantOperand(); Type retType = Type.getReturnType(sig); - if (retType.getSignature().startsWith("L")) + if (retType.getSignature().startsWith("L")) { + invokePC = getPC(); state = SEEN_INVOKE; + } } break; @@ -90,17 +100,19 @@ case SEEN_POP: if ((seen >= ACONST_NULL) && (seen <= DCONST_1)) { - bugReporter.reportBug(new BugInstance(this, "NIR_NEEDLESS_INSTANCE_RETRIEVAL", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + if (lnTable.getSourceLine(invokePC) == lnTable.getSourceLine(getPC())) { + bugReporter.reportBug(new BugInstance(this, "NIR_NEEDLESS_INSTANCE_RETRIEVAL", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } state = SEEN_NOTHING; break; - - default: - state = SEEN_NOTHING; - break; + + default: + state = SEEN_NOTHING; + break; } } } |
From: Dave B. <dbr...@us...> - 2006-02-05 00:56:26
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7069/src/com/mebigfatguy/fbcontrib/detect Modified Files: NeedlessInstanceRetrieval.java Log Message: duh, set state to SEEN_NOTHING on any other opcode Index: NeedlessInstanceRetrieval.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NeedlessInstanceRetrieval.java 4 Feb 2006 02:23:50 -0000 1.1 +++ NeedlessInstanceRetrieval.java 5 Feb 2006 00:56:16 -0000 1.2 @@ -97,6 +97,10 @@ } state = SEEN_NOTHING; break; + + default: + state = SEEN_NOTHING; + break; } } } |
From: Dave B. <dbr...@us...> - 2006-02-04 21:34:32
|
Update of /cvsroot/fb-contrib/fb-contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29131 Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- .cvsignore *.fb *.jar *.txt *.db |
From: Dave B. <dbr...@us...> - 2006-02-04 21:30:33
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27626/samples Added Files: .cvsignore Log Message: add .cvsignores --- NEW FILE: .cvsignore --- "*.class" |
From: Dave B. <dbr...@us...> - 2006-02-04 21:30:33
|
Update of /cvsroot/fb-contrib/fb-contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27626 Modified Files: build.xml Log Message: add .cvsignores Index: build.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/build.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- build.xml 15 Jan 2006 23:45:00 -0000 1.26 +++ build.xml 4 Feb 2006 21:30:25 -0000 1.27 @@ -39,6 +39,11 @@ <pathelement location="${lib.dir}/findbugs.jar"/> <pathelement location="${lib.dir}/bcel.jar"/> </path> + <mkdir dir="${classes.dir}/com"/> + <mkdir dir="${classes.dir}/com/mebigfatguy"/> + <mkdir dir="${classes.dir}/com/mebigfatguy/fbcontrib"/> + <mkdir dir="${classes.dir}/com/mebigfatguy/fbcontrib/detect"/> + <echo message="*.class" file="${classes.dir}/com/mebigfatguy/fbcontrib/detect/.cvsignore"/> </target> <target name="validate_xml" depends="-init" description="validates the xml files"> |
From: Dave B. <dbr...@us...> - 2006-02-04 02:26:11
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21246/htdocs Modified Files: index.html Log Message: Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- index.html 4 Feb 2006 02:23:50 -0000 1.59 +++ index.html 4 Feb 2006 02:26:03 -0000 1.60 @@ -78,7 +78,7 @@ <li><b>Needless Instance Retrieval</b><br/> Looks for methods that call a method to retrieve a reference to an object only to then load a static field of that object's class. It is simpler and more - preformant to just directly load the field from the class itself.</li> + performant to just directly load the field from the class itself.</li> </ul> </div> |
From: Dave B. <dbr...@us...> - 2006-02-04 02:23:58
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20310/src/com/mebigfatguy/fbcontrib/detect Added Files: NeedlessInstanceRetrieval.java Log Message: intial checkin - NIR detector --- NEW FILE: NeedlessInstanceRetrieval.java --- /* * fb-contrib - Auxilliary detectors for Java programs * Copyright (C) 2005-2006 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package com.mebigfatguy.fbcontrib.detect; import org.apache.bcel.classfile.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.StatelessDetector; public class NeedlessInstanceRetrieval extends BytecodeScanningDetector implements StatelessDetector { private static final int SEEN_NOTHING = 0; private static final int SEEN_INVOKE = 1; private static final int SEEN_POP = 2; private BugReporter bugReporter; private int state; /** * constructs a NIR detector given the reporter to report bugs on * @param bugReporter the sync of bug reports */ public NeedlessInstanceRetrieval(BugReporter bugReporter) { this.bugReporter = bugReporter; } /** * clone this detector so that it can be a StatelessDetector * * @return a clone of this object */ @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } /** * overrides the interface to reset the state * * @param obj the context objeft of the currently parsed method */ @Override public void visitMethod(Method obj) { state = SEEN_NOTHING; } /** * overrides the interface to find accesses of static variables off of an instance * immediately fetched from a method call. * * @param seen the opcode of the currently visited instruction */ @Override public void sawOpcode(int seen) { switch (state) { case SEEN_NOTHING: if ((seen == INVOKEINTERFACE) || (seen == INVOKEVIRTUAL)) { String sig = getSigConstantOperand(); Type retType = Type.getReturnType(sig); if (retType.getSignature().startsWith("L")) state = SEEN_INVOKE; } break; case SEEN_INVOKE: if (seen == POP) state = SEEN_POP; else state = SEEN_NOTHING; break; case SEEN_POP: if ((seen >= ACONST_NULL) && (seen <= DCONST_1)) { bugReporter.reportBug(new BugInstance(this, "NIR_NEEDLESS_INSTANCE_RETRIEVAL", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); } state = SEEN_NOTHING; break; } } } |
From: Dave B. <dbr...@us...> - 2006-02-04 02:23:58
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20310/etc Modified Files: findbugs.xml messages.xml Log Message: intial checkin - NIR detector Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- messages.xml 2 Feb 2006 06:18:02 -0000 1.52 +++ messages.xml 4 Feb 2006 02:23:50 -0000 1.53 @@ -431,6 +431,17 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessInstanceRetrieval"> + <Details> + <![CDATA[ + <p>Looks for methods that call a method to retrieve a reference to an object, + to use to load a constant. It is simpler and more performant to access the + static variable directly from the class itself.</p> + <p>It is a fast Detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -848,12 +859,19 @@ ]]> </Details> </BugPattern> - - 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. + + <BugPattern type="NIR_NEEDLESS_INSTANCE_RETRIEVAL"> + <ShortDescription>method retrieves instance to load static member</ShortDescription> + <LongDescription>method {1} retrieves instance to load static member</LongDescription> + <Details> + <![CDATA[ + <p>This method calls a method to load a reference to an object, and then only + uses it to load a static member of that instance's class. It is simpler and + better performant to just load the static field from the class itself.</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -889,4 +907,5 @@ <BugCode abbrev="SCR">Sloppy Class Reflection</BugCode> <BugCode abbrev="AWCBR">Array Wrapped Call By Reference</BugCode> <BugCode abbrev="SG">Sluggish Gui</BugCode> + <BugCode abbrev="NIR">Needless Instance Retrieval</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.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- findbugs.xml 2 Feb 2006 06:18:02 -0000 1.58 +++ findbugs.xml 4 Feb 2006 02:23:50 -0000 1.59 @@ -145,6 +145,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SluggishGui" speed="fast" reports="SG_SLUGGISH_GUI" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessInstanceRetrieval" + speed="fast" + reports="NIR_NEEDLESS_INSTANCE_RETRIEVAL" /> <!-- BugPattern --> @@ -181,4 +185,5 @@ <BugPattern abbrev="SCR" type="SCR_SLOPPY_CLASS_REFLECTION" category="STYLE" experimental="true" /> <BugPattern abbrev="AWCBR" type="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" category="STYLE" experimental="true" /> <BugPattern abbrev="SG" type="SG_SLUGGISH_GUI" category="PERFORMANCE" experimental="true" /> + <BugPattern abbrev="NIR" type="NIR_NEEDLESS_INSTANCE_RETRIEVAL" category="PERFORMANCE" experimental="true" /> </FindbugsPlugin> \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2006-02-04 02:23:58
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20310/htdocs Modified Files: index.html Log Message: intial checkin - NIR detector Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- index.html 2 Feb 2006 06:18:02 -0000 1.58 +++ index.html 4 Feb 2006 02:23:50 -0000 1.59 @@ -50,12 +50,6 @@ Note: fb-contrib v2.2.0 requires FindBugs™ v0.95 or later<br/> <div id="cvs" style="display:block;"> <ul> - <li><b>Sluggish Gui</b><br/> - 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.</li> <li><b>Bloated Synchronized Block</b><br/> Looks for methods that implement synchronized blocks that appear to contain some code at the beginning that does not need to be synchronized. Moving these lines out of the synchronized @@ -75,6 +69,16 @@ Looks for methods that use an array of length one to pass a variable to achieve call by pointer ala C++. It is better to define a proper return class type that holds all the relevant information retrieved from the called method.</li> + <li><b>Sluggish Gui</b><br/> + 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.</li> + <li><b>Needless Instance Retrieval</b><br/> + Looks for methods that call a method to retrieve a reference to an object + only to then load a static field of that object's class. It is simpler and more + preformant to just directly load the field from the class itself.</li> </ul> </div> |
From: Dave B. <dbr...@us...> - 2006-02-04 02:23:58
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20310/samples Added Files: NIR_Sample.java Log Message: intial checkin - NIR detector --- NEW FILE: NIR_Sample.java --- import javax.swing.JFrame; public class NIR_Sample extends JFrame { public static final int NIR_VALUE = 1; public NIR_Sample getSample() { return this; } public void test1() { System.out.println(getSample().NIR_VALUE); } public void test2() { System.out.println(getColorModel().TRANSLUCENT); } } |
From: Dave B. <dbr...@us...> - 2006-02-04 01:23:14
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30409/src/com/mebigfatguy/fbcontrib/detect Modified Files: NeedlessAutoboxing.java Log Message: add @Override s Index: NeedlessAutoboxing.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- NeedlessAutoboxing.java 4 Jan 2006 02:40:42 -0000 1.5 +++ NeedlessAutoboxing.java 4 Feb 2006 01:23:06 -0000 1.6 @@ -62,14 +62,17 @@ * * @return a clone of this object */ + @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } + @Override public void visitMethod(Method obj) { state = SEEN_NOTHING; } + @Override public void sawOpcode(int seen) { switch (state) { |