fb-contrib-commit Mailing List for fb-contrib (Page 69)
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...> - 2005-12-06 05:41:05
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12396/src/com/mebigfatguy/fbcontrib/detect Modified Files: CyclomaticComplexity.java Log Message: javadoc Index: CyclomaticComplexity.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- CyclomaticComplexity.java 5 Dec 2005 05:21:15 -0000 1.7 +++ CyclomaticComplexity.java 6 Dec 2005 05:40:57 -0000 1.8 @@ -64,14 +64,27 @@ return super.clone(); } + /** + * overrides the visitor to store the class context + * + * @param context the context object for the currently parsed class + */ public void visitClassContext(final ClassContext context) { classContext = context; classContext.getJavaClass().accept(this); } + /** + * implement the detector with null implementation + */ public void report() { } + /** + * overrides the visitor to navigate the basic block list to count branches + * + * @param obj the method of the currently parsed method + */ @Override public void visitMethod(final Method obj) { try { |
From: Dave B. <dbr...@us...> - 2005-12-06 05:38:39
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11711/src/com/mebigfatguy/fbcontrib/detect Modified Files: ConfusingAutoboxedOverloading.java Log Message: javadoc Index: ConfusingAutoboxedOverloading.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ConfusingAutoboxedOverloading.java 5 Dec 2005 05:21:15 -0000 1.4 +++ ConfusingAutoboxedOverloading.java 6 Dec 2005 05:38:31 -0000 1.5 @@ -65,6 +65,11 @@ return super.clone(); } + /** + * overrides the visitor to look for confusing signatures + * + * @param classContent the context object that holds the JavaClass currently being parsed + */ public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); @@ -93,6 +98,13 @@ } } + /** + * returns if one signature is a Character and the other is a primitive + * @param sig1 the first method signature + * @param sig2 the second method signature + * + * @return if one signature is a Character and the other a primitive + */ private boolean confusingSignatures(String sig1, String sig2) { if (sig1.equals(sig2)) return false; @@ -124,6 +136,12 @@ return foundParmDiff; } + /** + * fills out a set of method details for possibly confusing method signatures + * + * @param cls the current class being parsed + * @param methodInfo a collection to hold possibly confusing methods + */ private void populateMethodInfo(JavaClass cls, Map<String, Set<String>> methodInfo) { try { if ("java.lang.Object".equals(cls.getClassName())) @@ -150,6 +168,13 @@ } } + /** + * returns whether a method signature has either a Character or primitive + * + * @param sig the method signature + * + * @return whether a method signature has either a Character or primitive + */ private boolean isPossiblyConfusingSignature(String sig) { Type[] types = Type.getArgumentTypes(sig); for (Type t : types) { @@ -162,6 +187,9 @@ return false; } + /** + * implements the detector with null implementation + */ public void report() { } } |
From: Dave B. <dbr...@us...> - 2005-12-05 05:43:52
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23618/src/com/mebigfatguy/fbcontrib/detect Modified Files: ClassEnvy.java Log Message: javadoc Index: ClassEnvy.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- ClassEnvy.java 5 Dec 2005 05:21:15 -0000 1.16 +++ ClassEnvy.java 5 Dec 2005 05:43:44 -0000 1.17 @@ -39,7 +39,10 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; - +/** + * finds methods that excessively use methods from another class. This probably means + * these methods should be defined in that other class. + */ public class ClassEnvy extends BytecodeScanningDetector implements StatelessDetector { private static final String ENVY_PERCENT_PROPERTY = "fb-contrib.ce.percent"; @@ -91,6 +94,11 @@ return super.clone(); } + /** + * overrides the visitor to collect package and class names + * + * @param classContext the context object that holds the JavaClass being parsed + */ @Override public void visitClassContext(final ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); @@ -99,10 +107,23 @@ super.visitClassContext(classContext); } + /** + * overrides the visitor to check whether the method is static + * + * @param obj the method currently being parsed + */ + @Override public void visitMethod(final Method obj) { methodName = obj.getName(); methodIsStatic = (obj.getAccessFlags() & ACC_STATIC) != 0; } + + /** + * 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 public void visitCode(final Code obj) { stack.resetForMethodEntry(this); @@ -143,6 +164,12 @@ } } + /** + * 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 public void sawOpcode(final int seen) { try { @@ -171,6 +198,13 @@ } } + /** + * 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) { try { JavaClass cls = Repository.lookupClass(name); @@ -191,6 +225,13 @@ } } + /** + * 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) { String calledClass = null; @@ -213,6 +254,12 @@ return true; } + /** + * 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) { if (calledClass.equals(clsName)) thisClsAccessCount++; @@ -231,6 +278,11 @@ } } + /** + * 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) { LineNumberTable lnt = getCode().getLineNumberTable(); if (lnt == null) @@ -244,6 +296,14 @@ } } } + + /** + * 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) { if (className.startsWith("java.") || className.startsWith("javax.")) @@ -283,6 +343,13 @@ return false; } + /** + * parses the package name from a fully qualified class name + * + * @param className the class in question + * + * @return the package of the class + */ private String getPackageName(final String className) { int dotPos = className.lastIndexOf("."); if (dotPos < 0) @@ -290,6 +357,15 @@ return className.substring(0, dotPos); } + /** + * returns whether or not the two packages have the same first 'depth' parts, if they exist + * + * @param packName1 the first package to check + * @param packName2 the second package to check + * @param depth the number of package parts to check + * + * @return if they are similar + */ private boolean similarPackages(final String packName1, final String packName2, int depth) { if (depth == 0) return true; |
From: Dave B. <dbr...@us...> - 2005-12-05 05:30:32
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21081/src/com/mebigfatguy/fbcontrib/detect Modified Files: AbstractClassEmptyMethods.java Log Message: java doc Index: AbstractClassEmptyMethods.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- AbstractClassEmptyMethods.java 5 Dec 2005 05:21:15 -0000 1.3 +++ AbstractClassEmptyMethods.java 5 Dec 2005 05:30:24 -0000 1.4 @@ -73,6 +73,11 @@ return super.clone(); } + /** + * overrides the visitor to check for abstract classes + * + * @param classContext the context object that holds the JavaClass being parsed + */ @Override public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); @@ -80,12 +85,22 @@ super.visitClassContext(classContext); } + /** + * overrides the visitor to grab the method name and reset the state + * + * obj the method being parsed + */ @Override public void visitMethod(Method obj) { methodName = obj.getName(); state = SEEN_NOTHING; } + /** + * overrides the visitor to filter out constructors + * + * @param obj the code to parse + */ @Override public void visitCode(Code obj) { if ("<init>".equals(methodName) || "<clinit>".equals(methodName)) @@ -94,6 +109,11 @@ super.visitCode(obj); } + /** + * overrides the visitor to look for empty methods or simple exception throwers + * + * @param seen the opcode currently being parsed + */ @Override public void sawOpcode(int seen) { try { |
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19094/src/com/mebigfatguy/fbcontrib/detect Modified Files: AbnormalFinallyBlockReturn.java AbstractClassEmptyMethods.java ClassEnvy.java ConfusingAutoboxedOverloading.java CyclomaticComplexity.java DeclaredRuntimeException.java DubiousListCollection.java FinalParameters.java FloatingPointLoops.java InefficientStringBuffering.java ListIndexedIterating.java LiteralStringComparison.java ManualArrayCopy.java NeedlessAutoboxing.java NonCollectionMethodUse.java OverlyConcreteParameter.java ParallelLists.java PartiallyConstructedObjectAccess.java SpuriousThreadStates.java StaticMethodInstanceInvocation.java SyncCollectionIterators.java UnnecessaryStoreBeforeReturn.java UnrelatedCollectionContents.java Log Message: more javadoc Index: NonCollectionMethodUse.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NonCollectionMethodUse.java 16 Nov 2005 07:08:59 -0000 1.2 +++ NonCollectionMethodUse.java 5 Dec 2005 05:21:15 -0000 1.3 @@ -43,10 +43,19 @@ } private BugReporter bugReporter; + /** + * constructs a NCMU detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public NonCollectionMethodUse(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(); Index: AbstractClassEmptyMethods.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- AbstractClassEmptyMethods.java 16 Nov 2005 07:08:59 -0000 1.2 +++ AbstractClassEmptyMethods.java 5 Dec 2005 05:21:15 -0000 1.3 @@ -30,6 +30,10 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * finds methods of abstract classes that do nothing, or just throw exceptions. Since this is an + * abstract class, it may be more correct to just leave the method abstract. + */ public class AbstractClassEmptyMethods extends BytecodeScanningDetector implements StatelessDetector { public static final int SEEN_NOTHING = 0; @@ -51,10 +55,19 @@ private String methodName; private int state; + /** + * constructs a ACEM detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public AbstractClassEmptyMethods(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(); Index: NeedlessAutoboxing.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NeedlessAutoboxing.java 3 Dec 2005 03:36:19 -0000 1.2 +++ NeedlessAutoboxing.java 5 Dec 2005 05:21:15 -0000 1.3 @@ -49,10 +49,19 @@ private int state; private String boxClass; + /** + * constructs a NAB detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public NeedlessAutoboxing(BugReporter bugReporter) { this.bugReporter = bugReporter; } + /** + * clone this detector so that it can be a StatelessDetector + * + * @return a clone of this object + */ public Object clone() throws CloneNotSupportedException { return super.clone(); } Index: ConfusingAutoboxedOverloading.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ConfusingAutoboxedOverloading.java 16 Nov 2005 07:08:59 -0000 1.3 +++ ConfusingAutoboxedOverloading.java 5 Dec 2005 05:21:15 -0000 1.4 @@ -47,10 +47,19 @@ } private BugReporter bugReporter; + /** + * constructs a CAO detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public ConfusingAutoboxedOverloading(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(); Index: ParallelLists.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ParallelLists.java 1 Oct 2005 07:38:02 -0000 1.6 +++ ParallelLists.java 5 Dec 2005 05:21:15 -0000 1.7 @@ -42,10 +42,19 @@ private Set<String> listFields = new HashSet<String>(); private Map<Integer, String> indexToFieldMap = new HashMap<Integer, String>(); + /** + * constructs a PL detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public ParallelLists(final 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(); Index: PartiallyConstructedObjectAccess.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- PartiallyConstructedObjectAccess.java 1 Oct 2005 07:38:02 -0000 1.3 +++ PartiallyConstructedObjectAccess.java 5 Dec 2005 05:21:15 -0000 1.4 @@ -36,11 +36,20 @@ private OpcodeStack stack; private boolean reportedCtor; + /** + * constructs a PCOA detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public PartiallyConstructedObjectAccess(final BugReporter bugReporter) { this.bugReporter = bugReporter; stack = new OpcodeStack(); } + /** + * 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(); Index: SpuriousThreadStates.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SpuriousThreadStates.java 5 Dec 2005 04:27:30 -0000 1.3 +++ SpuriousThreadStates.java 5 Dec 2005 05:21:15 -0000 1.4 @@ -32,10 +32,19 @@ private BugReporter bugReporter; private OpcodeStack stack = new OpcodeStack(); + /** + * constructs a STS detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public SpuriousThreadStates(BugReporter bugReporter) { this.bugReporter = bugReporter; } + /** + * clone this detector so that it can be a StatelessDetector + * + * @return a clone of this object + */ public Object clone() throws CloneNotSupportedException { return super.clone(); } Index: DubiousListCollection.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- DubiousListCollection.java 5 Dec 2005 04:29:50 -0000 1.7 +++ DubiousListCollection.java 5 Dec 2005 05:21:15 -0000 1.8 @@ -62,6 +62,10 @@ private OpcodeStack stack = new OpcodeStack(); private Map<String, Integer> fieldsReported = new HashMap<String, Integer>(); + /** + * constructs a DLC detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public DubiousListCollection(final BugReporter bugReporter) { this.bugReporter = bugReporter; } Index: AbnormalFinallyBlockReturn.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- AbnormalFinallyBlockReturn.java 5 Dec 2005 05:00:50 -0000 1.6 +++ AbnormalFinallyBlockReturn.java 5 Dec 2005 05:21:15 -0000 1.7 @@ -43,6 +43,7 @@ /** * constructs a AFBR detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports */ public AbnormalFinallyBlockReturn(final BugReporter bugReporter) { Index: FinalParameters.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- FinalParameters.java 29 Oct 2005 23:33:24 -0000 1.8 +++ FinalParameters.java 5 Dec 2005 05:21:15 -0000 1.9 @@ -56,10 +56,19 @@ private String[] sourceLines; + /** + * constructs a FP detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public FinalParameters(final 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(); Index: UnnecessaryStoreBeforeReturn.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- UnnecessaryStoreBeforeReturn.java 4 Dec 2005 06:41:24 -0000 1.4 +++ UnnecessaryStoreBeforeReturn.java 5 Dec 2005 05:21:15 -0000 1.5 @@ -61,19 +61,31 @@ private int storeReg; private int loadReg; + /** + * constructs a USBR detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public UnnecessaryStoreBeforeReturn(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(); } + @Override public void visitMethod(Method obj) { state = SEEN_NOTHING; branchTargets.clear(); } + @Override public void sawOpcode(int seen) { switch (state) { case SEEN_NOTHING: Index: FloatingPointLoops.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- FloatingPointLoops.java 16 Nov 2005 07:08:59 -0000 1.6 +++ FloatingPointLoops.java 5 Dec 2005 05:21:15 -0000 1.7 @@ -40,10 +40,19 @@ BugReporter bugReporter; private Set<FloatForLoop> forLoops = new HashSet<FloatForLoop>(); + /** + * constructs a FPL detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public FloatingPointLoops(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(); Index: ListIndexedIterating.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ListIndexedIterating.java 5 Nov 2005 01:54:27 -0000 1.8 +++ ListIndexedIterating.java 5 Dec 2005 05:21:15 -0000 1.9 @@ -51,12 +51,21 @@ private int loopReg; private boolean sawListSize; + /** + * constructs a LII detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public ListIndexedIterating(final BugReporter bugReporter) { this.bugReporter = bugReporter; stack = new OpcodeStack(); possibleForLoops = new HashSet<ForLoop>(); } + /** + * 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(); Index: SyncCollectionIterators.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- SyncCollectionIterators.java 4 Dec 2005 03:47:36 -0000 1.8 +++ SyncCollectionIterators.java 5 Dec 2005 05:21:15 -0000 1.9 @@ -64,10 +64,19 @@ private OpcodeStack stack = new OpcodeStack(); private Object collectionInfo = null; + /** + * constructs a SCI detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public SyncCollectionIterators(final 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(); Index: ClassEnvy.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ClassEnvy.java 7 Nov 2005 02:50:11 -0000 1.15 +++ ClassEnvy.java 5 Dec 2005 05:21:15 -0000 1.16 @@ -61,6 +61,10 @@ private double envyPercent = 0.90; private int envyMin = 5; + /** + * constructs a CE detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public ClassEnvy(final BugReporter bugReporter) { this.bugReporter = bugReporter; stack = new OpcodeStack(); @@ -77,6 +81,11 @@ envyMin = min.intValue(); } + /** + * 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(); Index: LiteralStringComparison.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- LiteralStringComparison.java 1 Oct 2005 07:38:02 -0000 1.4 +++ LiteralStringComparison.java 5 Dec 2005 05:21:15 -0000 1.5 @@ -30,11 +30,20 @@ private BugReporter bugReporter; private OpcodeStack stack; + /** + * constructs a LSC detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public LiteralStringComparison(final BugReporter bugReporter) { this.bugReporter = bugReporter; stack = new OpcodeStack(); } + /** + * 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(); Index: OverlyConcreteParameter.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- OverlyConcreteParameter.java 11 Nov 2005 02:51:11 -0000 1.24 +++ OverlyConcreteParameter.java 5 Dec 2005 05:21:15 -0000 1.25 @@ -54,6 +54,10 @@ private boolean methodImplementsInterface; private boolean methodIsStatic; + /** + * constructs a OCP detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public OverlyConcreteParameter(final BugReporter bugReporter) { this.bugReporter = bugReporter; try { @@ -64,6 +68,11 @@ } } + /** + * 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(); Index: DeclaredRuntimeException.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- DeclaredRuntimeException.java 5 Dec 2005 04:29:06 -0000 1.6 +++ DeclaredRuntimeException.java 5 Dec 2005 05:21:15 -0000 1.7 @@ -49,10 +49,19 @@ } } + /** + * constructs a DRE detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public DeclaredRuntimeException(final 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(); Index: UnrelatedCollectionContents.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- UnrelatedCollectionContents.java 3 Dec 2005 03:36:51 -0000 1.9 +++ UnrelatedCollectionContents.java 5 Dec 2005 05:21:15 -0000 1.10 @@ -57,11 +57,20 @@ private Map<String, Set<SourceLineAnnotation>>memberSourceLineAnnotations; private Map<Integer, Set<SourceLineAnnotation>>localSourceLineAnnotations; + /** + * constructs a UCC detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public UnrelatedCollectionContents(final BugReporter bugReporter) { this.bugReporter = bugReporter; stack = new OpcodeStack(); } + /** + * 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(); Index: CyclomaticComplexity.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CyclomaticComplexity.java 10 Oct 2005 07:05:01 -0000 1.6 +++ CyclomaticComplexity.java 5 Dec 2005 05:21:15 -0000 1.7 @@ -43,6 +43,10 @@ private ClassContext classContext; private int reportLimit = 50; + /** + * constructs a CC detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public CyclomaticComplexity(final BugReporter bugReporter) { this.bugReporter = bugReporter; Integer limit = Integer.getInteger(LIMIT_PROPERTY); @@ -50,6 +54,11 @@ reportLimit = limit.intValue(); } + /** + * 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(); Index: StaticMethodInstanceInvocation.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- StaticMethodInstanceInvocation.java 17 Nov 2005 05:23:15 -0000 1.3 +++ StaticMethodInstanceInvocation.java 5 Dec 2005 05:21:15 -0000 1.4 @@ -37,10 +37,19 @@ private OpcodeStack stack = new OpcodeStack(); private List<PopInfo> popStack = new ArrayList<PopInfo>(); + /** + * constructs a SMII detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public StaticMethodInstanceInvocation(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(); Index: ManualArrayCopy.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ManualArrayCopy.java 16 Nov 2005 07:08:59 -0000 1.2 +++ ManualArrayCopy.java 5 Dec 2005 05:21:15 -0000 1.3 @@ -38,10 +38,19 @@ private int arrayIndexReg; private int loadInstruction; + /** + * constructs a MAC detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public ManualArrayCopy(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(); Index: InefficientStringBuffering.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- InefficientStringBuffering.java 18 Oct 2005 04:22:42 -0000 1.5 +++ InefficientStringBuffering.java 5 Dec 2005 05:21:15 -0000 1.6 @@ -32,11 +32,20 @@ private BugReporter bugReporter; private OpcodeStack opStack; + /** + * constructs a ISB detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public InefficientStringBuffering(final BugReporter bugReporter) { this.bugReporter = bugReporter; opStack = new OpcodeStack(); } + /** + * 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(); |
From: Dave B. <dbr...@us...> - 2005-12-05 05:14:48
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17768/src/com/mebigfatguy/fbcontrib Added Files: package.html Log Message: javadoc --- NEW FILE: package.html --- <html> <body> provides jar double click functionality - information </body> </html> |
From: Dave B. <dbr...@us...> - 2005-12-05 05:07:39
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15602/src/com/mebigfatguy/fbcontrib/detect Added Files: package.html Log Message: javadoc --- NEW FILE: package.html --- <html> <body> provides bug detectors for the FindBugs™ tool.<br/> FindBugs is a trademark of the University of Maryland </body> </html> |
From: Dave B. <dbr...@us...> - 2005-12-05 05:01:00
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13952/src/com/mebigfatguy/fbcontrib/detect Modified Files: AbnormalFinallyBlockReturn.java Log Message: javadoc Index: AbnormalFinallyBlockReturn.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- AbnormalFinallyBlockReturn.java 22 Nov 2005 03:51:05 -0000 1.5 +++ AbnormalFinallyBlockReturn.java 5 Dec 2005 05:00:50 -0000 1.6 @@ -30,6 +30,10 @@ import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; +/** + * find methods that return or throw exception from a finally block. Doing so short-circuits the + * return or exception thrown from the try block, and masks it. + */ public class AbnormalFinallyBlockReturn extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; private CodeException[] exc; @@ -37,15 +41,29 @@ private int majorVersion; private int loadedReg; + /** + * constructs a AFBR detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ public AbnormalFinallyBlockReturn(final 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 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 public void visitClassContext(ClassContext classContext) { majorVersion = classContext.getJavaClass().getMajor(); @@ -53,6 +71,11 @@ super.visitClassContext(classContext); } + /** + * 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(); @@ -72,6 +95,11 @@ 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.size() == 0) @@ -127,6 +155,9 @@ } } + /** + * holds the finally block information for a particular method + */ public static class FinallyBlockInfo { public int startPC; @@ -134,6 +165,12 @@ 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) { startPC = start; endPC = end; |
From: Dave B. <dbr...@us...> - 2005-12-05 04:51:37
|
Update of /cvsroot/fb-contrib/fb-contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11948 Modified Files: build.xml Log Message: add classpathref Index: build.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/build.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- build.xml 5 Dec 2005 04:48:50 -0000 1.19 +++ build.xml 5 Dec 2005 04:51:29 -0000 1.20 @@ -119,6 +119,7 @@ <target name="javadoc" depends="-init" description="build the javadoc for the project"> <javadoc packagenames="com.mebigfatguy.*" sourcepath="${src.dir}" + classpathref="fb-contrib.classpath" destdir="${javadoc.dir}" windowtitle="fb-contrib api"> <doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle> |
From: Dave B. <dbr...@us...> - 2005-12-05 04:48:59
|
Update of /cvsroot/fb-contrib/fb-contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11399 Modified Files: build.xml Log Message: add javadoc target Index: build.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/build.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- build.xml 1 Dec 2005 04:01:55 -0000 1.18 +++ build.xml 5 Dec 2005 04:48:50 -0000 1.19 @@ -12,6 +12,7 @@ <property name="lib.dir" value="${basedir}/lib"/> <property name="etc.dir" value="${basedir}/etc"/> <property name="samples.dir" value="${basedir}/samples"/> + <property name="javadoc.dir" value="${basedir}/javadoc"/> <property name="javac.source" value="1.5"/> <property name="javac.target" value="jsr14"/> <property name="javac.deprecation" value="on"/> @@ -21,6 +22,7 @@ <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> + <delete dir="${javadoc.dir}"/> <delete file="${basedir}/fb-contrib.jar"/> <delete file="${basedir}/fb-contrib-src.zip"/> <delete> @@ -32,6 +34,7 @@ <target name="-init" description="prepares repository for a build"> <mkdir dir="${classes.dir}"/> + <mkdir dir="${javadoc.dir}"/> <path id="fb-contrib.classpath"> <pathelement location="${lib.dir}/findbugs.jar"/> <pathelement location="${lib.dir}/bcel.jar"/> @@ -112,4 +115,14 @@ </fileset> </zip> </target> + + <target name="javadoc" depends="-init" description="build the javadoc for the project"> + <javadoc packagenames="com.mebigfatguy.*" + sourcepath="${src.dir}" + destdir="${javadoc.dir}" + windowtitle="fb-contrib api"> + <doctitle><![CDATA[<h1>fb-contrib javadoc</h1>]]></doctitle> + <bottom><![CDATA[<i>Copyright © 2005 MeBigFatGuy.com. All Rights Reserved.</i>]]></bottom> + </javadoc> + </target> </project> \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2005-12-05 04:30:01
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7602/src/com/mebigfatguy/fbcontrib/detect Modified Files: DubiousListCollection.java Log Message: fix USBR example Index: DubiousListCollection.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- DubiousListCollection.java 7 Nov 2005 02:50:11 -0000 1.6 +++ DubiousListCollection.java 5 Dec 2005 04:29:50 -0000 1.7 @@ -135,8 +135,7 @@ int parmCount = Type.getArgumentTypes(signature).length; if (stk.getStackDepth() > parmCount) { OpcodeStack.Item itm = stk.getStackItem(parmCount); - FieldAnnotation fa = itm.getField(); - return fa; + return itm.getField(); } return null; } |
From: Dave B. <dbr...@us...> - 2005-12-05 04:29:16
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7480/src/com/mebigfatguy/fbcontrib/detect Modified Files: DeclaredRuntimeException.java Log Message: init static members in <clinit>, not <init> Index: DeclaredRuntimeException.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- DeclaredRuntimeException.java 1 Oct 2005 07:38:02 -0000 1.5 +++ DeclaredRuntimeException.java 5 Dec 2005 04:29:06 -0000 1.6 @@ -41,7 +41,7 @@ private static final Set<String> notFoundExceptions = new HashSet<String>(); private static JavaClass runtimeExceptionClass; - { + static { try { runtimeExceptionClass = Repository.lookupClass("java.lang.RuntimeException"); } catch (ClassNotFoundException cnfe) { |
From: Dave B. <dbr...@us...> - 2005-12-05 04:27:41
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7187/src/com/mebigfatguy/fbcontrib/detect Modified Files: SpuriousThreadStates.java Log Message: interface cleanup Index: SpuriousThreadStates.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SpuriousThreadStates.java 3 Dec 2005 03:36:19 -0000 1.2 +++ SpuriousThreadStates.java 5 Dec 2005 04:27:30 -0000 1.3 @@ -18,7 +18,6 @@ */ package com.mebigfatguy.fbcontrib.detect; -import org.apache.bcel.Constants; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; @@ -28,7 +27,7 @@ import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.StatelessDetector; -public class SpuriousThreadStates extends BytecodeScanningDetector implements Constants, StatelessDetector +public class SpuriousThreadStates extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; private OpcodeStack stack = new OpcodeStack(); |
From: Dave B. <dbr...@us...> - 2005-12-04 06:41:33
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26460/src/com/mebigfatguy/fbcontrib/detect Modified Files: UnnecessaryStoreBeforeReturn.java Log Message: fix fp's for ifnull and ifnonnull branch targets as well Index: UnnecessaryStoreBeforeReturn.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- UnnecessaryStoreBeforeReturn.java 4 Dec 2005 05:32:46 -0000 1.3 +++ UnnecessaryStoreBeforeReturn.java 4 Dec 2005 06:41:24 -0000 1.4 @@ -36,6 +36,7 @@ private static final Set<Integer> branchInstructions = new HashSet<Integer>(); static { branchInstructions.add(new Integer(GOTO)); + branchInstructions.add(new Integer(GOTO_W)); branchInstructions.add(new Integer(IFEQ)); branchInstructions.add(new Integer(IFNE)); branchInstructions.add(new Integer(IFLT)); @@ -50,6 +51,8 @@ branchInstructions.add(new Integer(IF_ICMPLE)); branchInstructions.add(new Integer(IF_ACMPEQ)); branchInstructions.add(new Integer(IF_ACMPNE)); + branchInstructions.add(new Integer(IFNULL)); + branchInstructions.add(new Integer(IFNONNULL)); } private BugReporter bugReporter; |
From: Dave B. <dbr...@us...> - 2005-12-04 05:32:54
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17455/src/com/mebigfatguy/fbcontrib/detect Modified Files: UnnecessaryStoreBeforeReturn.java Log Message: remove false positives when the load (for the return) is a branch target. Index: UnnecessaryStoreBeforeReturn.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- UnnecessaryStoreBeforeReturn.java 3 Dec 2005 16:47:19 -0000 1.2 +++ UnnecessaryStoreBeforeReturn.java 4 Dec 2005 05:32:46 -0000 1.3 @@ -18,6 +18,9 @@ */ package com.mebigfatguy.fbcontrib.detect; +import java.util.HashSet; +import java.util.Set; + import org.apache.bcel.classfile.Method; import edu.umd.cs.findbugs.BugInstance; @@ -30,8 +33,27 @@ private static final int SEEN_NOTHING = 0; private static final int SEEN_STORE = 1; private static final int SEEN_LOAD = 2; + private static final Set<Integer> branchInstructions = new HashSet<Integer>(); + static { + branchInstructions.add(new Integer(GOTO)); + branchInstructions.add(new Integer(IFEQ)); + branchInstructions.add(new Integer(IFNE)); + branchInstructions.add(new Integer(IFLT)); + branchInstructions.add(new Integer(IFGE)); + branchInstructions.add(new Integer(IFGT)); + branchInstructions.add(new Integer(IFLE)); + branchInstructions.add(new Integer(IF_ICMPEQ)); + branchInstructions.add(new Integer(IF_ICMPNE)); + branchInstructions.add(new Integer(IF_ICMPLT)); + branchInstructions.add(new Integer(IF_ICMPGE)); + branchInstructions.add(new Integer(IF_ICMPGT)); + branchInstructions.add(new Integer(IF_ICMPLE)); + branchInstructions.add(new Integer(IF_ACMPEQ)); + branchInstructions.add(new Integer(IF_ACMPNE)); + } private BugReporter bugReporter; + private Set<Integer> branchTargets = new HashSet<Integer>(); private int state; private int storeReg; private int loadReg; @@ -46,6 +68,7 @@ public void visitMethod(Method obj) { state = SEEN_NOTHING; + branchTargets.clear(); } public void sawOpcode(int seen) { @@ -73,6 +96,11 @@ break; case SEEN_STORE: + if (branchTargets.contains(new Integer(getPC()))) { + seen = SEEN_NOTHING; + return; + } + if ((seen >= ILOAD) && (seen <= ALOAD)) { loadReg = getRegisterOperand(); state = (storeReg == loadReg) ? SEEN_LOAD : SEEN_NOTHING; @@ -105,6 +133,11 @@ state = SEEN_NOTHING; break; } + + if (branchInstructions.contains(new Integer(seen))) { + branchTargets.add(new Integer(getBranchTarget())); + } + } } |
From: Dave B. <dbr...@us...> - 2005-12-04 03:47:44
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2032/src/com/mebigfatguy/fbcontrib/detect Modified Files: SyncCollectionIterators.java Log Message: no need to create seperate classes Index: SyncCollectionIterators.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- SyncCollectionIterators.java 11 Nov 2005 04:29:25 -0000 1.7 +++ SyncCollectionIterators.java 4 Dec 2005 03:47:36 -0000 1.8 @@ -38,20 +38,20 @@ public class SyncCollectionIterators extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; - private static Set<String> synchCollectionNames = new HashSet<String>() - {{ - add("synchronizedSet"); - add("synchronizedMap"); - add("synchronizedList"); - add("synchronizedSortedSet"); - add("synchronizedSortedMap"); - }}; - private static Set<String> mapToSetMethods = new HashSet<String>() - {{ - add("keySet"); - add("entrySet"); - add("values"); - }}; + private static Set<String> synchCollectionNames = new HashSet<String>(); + static { + synchCollectionNames.add("synchronizedSet"); + synchCollectionNames.add("synchronizedMap"); + synchCollectionNames.add("synchronizedList"); + synchCollectionNames.add("synchronizedSortedSet"); + synchCollectionNames.add("synchronizedSortedMap"); + }; + private static Set<String> mapToSetMethods = new HashSet<String>(); + static { + mapToSetMethods.add("keySet"); + mapToSetMethods.add("entrySet"); + mapToSetMethods.add("values"); + }; private static final int SEEN_NOTHING = 0; private static final int SEEN_SYNC = 1; |
From: Dave B. <dbr...@us...> - 2005-12-03 16:55:26
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11793/htdocs Modified Files: index.html Log Message: make the blend go down further Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- index.html 3 Dec 2005 16:46:47 -0000 1.36 +++ index.html 3 Dec 2005 16:55:18 -0000 1.37 @@ -29,7 +29,7 @@ </script> </head> <body background> - <div style="position:absolute;top:0;left:0;width:256;height:100%;z-index:1;background-image:url(blend.jpg);"> + <div style="position:absolute;top:0;left:0;width:256;height:65535;z-index:1;background-image:url(blend.jpg);"> </div> <div style="position:absolute;top:20;left:20;z-index:2;"> |
From: Dave B. <dbr...@us...> - 2005-12-03 16:47:28
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10548/src/com/mebigfatguy/fbcontrib/detect Modified Files: UnnecessaryStoreBeforeReturn.java Log Message: add copyright Index: UnnecessaryStoreBeforeReturn.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- UnnecessaryStoreBeforeReturn.java 3 Dec 2005 16:46:47 -0000 1.1 +++ UnnecessaryStoreBeforeReturn.java 3 Dec 2005 16:47:19 -0000 1.2 @@ -1,3 +1,21 @@ +/* + * fb-contrib - Auxilliary detectors for Java programs + * Copyright (C) 2005 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; |
From: Dave B. <dbr...@us...> - 2005-12-03 16:46:55
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10418/samples Added Files: USBR_Sample.java Log Message: initial checkin - USBR detector --- NEW FILE: USBR_Sample.java --- import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; public class USBR_Sample { public int addEm(String csl) { String[] tokens = csl.split(","); int sum = 0; for (String s : tokens) { sum += Integer.valueOf(s); } int ave = sum / tokens.length; return ave; } } |
From: Dave B. <dbr...@us...> - 2005-12-03 16:46:55
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10418/src/com/mebigfatguy/fbcontrib/detect Added Files: UnnecessaryStoreBeforeReturn.java Log Message: initial checkin - USBR detector --- NEW FILE: UnnecessaryStoreBeforeReturn.java --- package com.mebigfatguy.fbcontrib.detect; import org.apache.bcel.classfile.Method; 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 UnnecessaryStoreBeforeReturn extends BytecodeScanningDetector implements StatelessDetector { private static final int SEEN_NOTHING = 0; private static final int SEEN_STORE = 1; private static final int SEEN_LOAD = 2; private BugReporter bugReporter; private int state; private int storeReg; private int loadReg; public UnnecessaryStoreBeforeReturn(BugReporter bugReporter) { this.bugReporter = bugReporter; } public Object clone() throws CloneNotSupportedException { return super.clone(); } public void visitMethod(Method obj) { state = SEEN_NOTHING; } public void sawOpcode(int seen) { switch (state) { case SEEN_NOTHING: if ((seen >= ISTORE) && (seen <= ASTORE)) { storeReg = getRegisterOperand(); state = SEEN_STORE; } else if ((seen >= ISTORE_0) && (seen <= ISTORE_3)) { storeReg = seen - ISTORE_0; state = SEEN_STORE; } else if ((seen >= LSTORE_0) && (seen <= LSTORE_3)) { storeReg = seen - LSTORE_0; state = SEEN_STORE; } else if ((seen >= FSTORE_0) && (seen <= FSTORE_3)) { storeReg = seen - FSTORE_0; state = SEEN_STORE; } else if ((seen >= DSTORE_0) && (seen <= DSTORE_3)) { storeReg = seen - DSTORE_0; state = SEEN_STORE; } else if ((seen >= ASTORE_0) && (seen <= ASTORE_3)) { storeReg = seen - ASTORE_0; state = SEEN_STORE; } break; case SEEN_STORE: if ((seen >= ILOAD) && (seen <= ALOAD)) { loadReg = getRegisterOperand(); state = (storeReg == loadReg) ? SEEN_LOAD : SEEN_NOTHING; } else if ((seen >= ILOAD_0) && (seen <= ILOAD_3)) { loadReg = seen - ILOAD_0; state = (storeReg == loadReg) ? SEEN_LOAD : SEEN_NOTHING; } else if ((seen >= LLOAD_0) && (seen <= LLOAD_3)) { loadReg = seen - LLOAD_0; state = (storeReg == loadReg) ? SEEN_LOAD : SEEN_NOTHING; } else if ((seen >= FLOAD_0) && (seen <= FLOAD_3)) { loadReg = seen - FLOAD_0; state = (storeReg == loadReg) ? SEEN_LOAD : SEEN_NOTHING; } else if ((seen >= DLOAD_0) && (seen <= DLOAD_3)) { loadReg = seen - DLOAD_0; state = (storeReg == loadReg) ? SEEN_LOAD : SEEN_NOTHING; } else if ((seen >= ALOAD_0) && (seen <= ALOAD_3)) { loadReg = seen - ALOAD_0; state = (storeReg == loadReg) ? SEEN_LOAD : SEEN_NOTHING; } else state = SEEN_NOTHING; break; case SEEN_LOAD: if ((seen >= IRETURN) && (seen <= ARETURN)) { bugReporter.reportBug(new BugInstance(this, "USBR_UNNECESSARY_STORE_BEFORE_RETURN", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); } state = SEEN_NOTHING; break; } } } |
From: Dave B. <dbr...@us...> - 2005-12-03 16:46:55
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10418/etc Modified Files: findbugs.xml messages.xml Log Message: initial checkin - USBR detector Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- messages.xml 3 Dec 2005 03:33:24 -0000 1.34 +++ messages.xml 3 Dec 2005 16:46:47 -0000 1.35 @@ -304,6 +304,17 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn"> + <Details> + <![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> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -578,7 +589,20 @@ ]]> </Details> </BugPattern> - + + <BugPattern type="USBR_UNNECESSARY_STORE_BEFORE_RETURN"> + <ShortDescription>method stores return result in local before immediately returning it</ShortDescription> + <LongDescription>method {1} stores return result in local before immediately returning it</LongDescription> + <Details> + <![CDATA[ + <p>This method stores the return result in a local variable, and then immediately + returns the local variable. It would be simpler just to return the value that is + assigned to the local variable, directly. + </p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -603,4 +627,5 @@ <BugCode abbrev="SMII">Static Method Instance Invocation</BugCode> <BugCode abbrev="STS">Spurious Thread States</BugCode> <BugCode abbrev="NAB">Needless Autoboxing</BugCode> + <BugCode abbrev="USBR">Unnecessary Store Before Return</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.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- findbugs.xml 3 Dec 2005 03:33:24 -0000 1.41 +++ findbugs.xml 3 Dec 2005 16:46:47 -0000 1.42 @@ -102,6 +102,10 @@ speed="fast" reports="NAB_NEEDLESS_AUTOBOXING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn" + speed="fast" + reports="USBR_UNNECESSARY_STORE_BEFORE_RETURN" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -126,4 +130,5 @@ <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" /> + <BugPattern abbrev="USBR" type="USBR_UNNECESSARY_STORE_BEFORE_RETURN" category="STYLE" experimental="true" /> </FindbugsPlugin> \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2005-12-03 16:46:55
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10418/htdocs Modified Files: index.html Log Message: initial checkin - USBR detector Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- index.html 3 Dec 2005 03:33:24 -0000 1.35 +++ index.html 3 Dec 2005 16:46:47 -0000 1.36 @@ -59,6 +59,9 @@ Finds methods that pass an instance of a primitive wrapper class, to a constructor of the same class. Since wrapper classes are immutable, you can just use the original instance, instead of creating a new one. This bug is a misuse of autoboxing.</li> + <li><b>UnnecessaryStoreBeforeReturn</b><br/> + Finds methods that store the return result in a local variable, and + then immediately returns that local variable.</li> </ul> </div> |
From: Dave B. <dbr...@us...> - 2005-12-03 03:36:58
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12081/src/com/mebigfatguy/fbcontrib/detect Modified Files: UnrelatedCollectionContents.java Log Message: no need for a separate class Index: UnrelatedCollectionContents.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- UnrelatedCollectionContents.java 1 Oct 2005 07:38:02 -0000 1.8 +++ UnrelatedCollectionContents.java 3 Dec 2005 03:36:51 -0000 1.9 @@ -40,15 +40,15 @@ public class UnrelatedCollectionContents extends BytecodeScanningDetector implements StatelessDetector { - private static final Set<String> COLLECTION_CLASSES = new HashSet<String>() - {{ - add("java/util/Collection"); - add("java/util/List"); - add("java/util/Map"); - add("java/util/Set"); - add("java/util/SortedMap"); - add("java/util/SortedSet"); - }}; + private static final Set<String> COLLECTION_CLASSES = new HashSet<String>(); + static { + COLLECTION_CLASSES.add("java/util/Collection"); + COLLECTION_CLASSES.add("java/util/List"); + COLLECTION_CLASSES.add("java/util/Map"); + COLLECTION_CLASSES.add("java/util/Set"); + COLLECTION_CLASSES.add("java/util/SortedMap"); + COLLECTION_CLASSES.add("java/util/SortedSet"); + }; private BugReporter bugReporter; private OpcodeStack stack; private Map<String, Set<String>> memberCollections; |
From: Dave B. <dbr...@us...> - 2005-12-03 03:36:27
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12022/src/com/mebigfatguy/fbcontrib/detect Modified Files: NeedlessAutoboxing.java SpuriousThreadStates.java Log Message: add copyright comment Index: NeedlessAutoboxing.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NeedlessAutoboxing.java 3 Dec 2005 03:33:24 -0000 1.1 +++ NeedlessAutoboxing.java 3 Dec 2005 03:36:19 -0000 1.2 @@ -1,3 +1,21 @@ +/* + * fb-contrib - Auxilliary detectors for Java programs + * Copyright (C) 2005 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ package com.mebigfatguy.fbcontrib.detect; import java.util.HashMap; Index: SpuriousThreadStates.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SpuriousThreadStates.java 1 Dec 2005 05:28:42 -0000 1.1 +++ SpuriousThreadStates.java 3 Dec 2005 03:36:19 -0000 1.2 @@ -1,3 +1,21 @@ +/* + * fb-contrib - Auxilliary detectors for Java programs + * Copyright (C) 2005 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.Constants; |
From: Dave B. <dbr...@us...> - 2005-12-03 03:33:32
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11646/htdocs Modified Files: index.html Log Message: initial checkin, NAB detector Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- index.html 1 Dec 2005 05:34:47 -0000 1.34 +++ index.html 3 Dec 2005 03:33:24 -0000 1.35 @@ -55,6 +55,10 @@ 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.</li> + <li><b>Needless Autoboxing</b><br/> + Finds methods that pass an instance of a primitive wrapper class, to a constructor + of the same class. Since wrapper classes are immutable, you can just use the original + instance, instead of creating a new one. This bug is a misuse of autoboxing.</li> </ul> </div> |