fb-contrib-commit Mailing List for fb-contrib (Page 68)
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-17 08:27:09
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14091/etc Modified Files: findbugs.xml messages.xml Log Message: initial checkin - new ABC detector Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- messages.xml 8 Dec 2005 03:46:59 -0000 1.36 +++ messages.xml 17 Dec 2005 08:27:00 -0000 1.37 @@ -325,6 +325,19 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayBasedCollections"> + <Details> + <![CDATA[ + <p>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. If it is, consider using the IdentityHashMap + class when using Maps in this case, to better document your intentions.</p> + </p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -625,6 +638,19 @@ </Details> </BugPattern> + <BugPattern type="ABC_ARRAY_BASED_COLLECTIONS"> + <ShortDescription>method uses array as basis of collection</ShortDescription> + <LongDescription>method {1} uses array as basis of collection</LongDescription> + <Details> + <![CDATA[ + <p>This method passes an array as the key to a Map, element in a Set, or item in a List when + the contains method is used on the List. Since arrays do not, and cannot override the equals + method, collection inclusion is based on the reference's address, which is probably not desired. + </p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -651,4 +677,5 @@ <BugCode abbrev="NAB">Needless Autoboxing</BugCode> <BugCode abbrev="USBR">Unnecessary Store Before Return</BugCode> <BugCode abbrev="COM">Copied Overridden Method</BugCode> + <BugCode abbrev="ABC">Array Based Collection</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.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- findbugs.xml 8 Dec 2005 03:46:59 -0000 1.43 +++ findbugs.xml 17 Dec 2005 08:27:00 -0000 1.44 @@ -109,6 +109,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod" speed="moderate" reports="COM_COPIED_OVERRIDDEN_METHOD" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayBasedCollections" + speed="fast" + reports="ABC_ARRAY_BASED_COLLECTIONS" /> <!-- BugPattern --> @@ -132,8 +136,9 @@ <BugPattern abbrev="CAO" type="CAO_CONFUSING_AUTOBOXED_OVERLOADING" category="CORRECTNESS" /> <BugPattern abbrev="AFBR" type="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" category="CORRECTNESS" /> <BugPattern abbrev="SMII" type="SMII_STATIC_METHOD_INSTANCE_INVOCATION" category="STYLE" /> - <BugPattern abbrev="STS" type="STS_SPURIOUS_THREAD_STATES" category="MT_CORRECTNESS" experimental="true" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING" category="PERFORMANCE" experimental="true" /> - <BugPattern abbrev="USBR" type="USBR_UNNECESSARY_STORE_BEFORE_RETURN" category="STYLE" experimental="true" /> - <BugPattern abbrev="COM" type="COM_COPIED_OVERRIDDEN_METHOD" category="STYLE" experimental="true" /> + <BugPattern abbrev="STS" type="STS_SPURIOUS_THREAD_STATES" category="MT_CORRECTNESS" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING" category="PERFORMANCE" /> + <BugPattern abbrev="USBR" type="USBR_UNNECESSARY_STORE_BEFORE_RETURN" category="STYLE" /> + <BugPattern abbrev="COM" type="COM_COPIED_OVERRIDDEN_METHOD" category="STYLE" /> + <BugPattern abbrev="ABC" type="ABC_ARRAY_BASED_COLLECTIONS" category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2005-12-17 08:27:09
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14091/src/com/mebigfatguy/fbcontrib/detect Added Files: ArrayBasedCollections.java Log Message: initial checkin - new ABC detector --- NEW FILE: ArrayBasedCollections.java --- /* * 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.Code; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.StatelessDetector; public class ArrayBasedCollections extends BytecodeScanningDetector implements StatelessDetector { private BugReporter bugReporter; private OpcodeStack stack = new OpcodeStack(); public ArrayBasedCollections(BugReporter bugReporter) { this.bugReporter = bugReporter; } @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } @Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); super.visitCode(obj); } @Override public void sawOpcode(int seen) { try { if (seen == INVOKEINTERFACE) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); String methodSig = getSigConstantOperand(); boolean found = false; if ("java/util/Map".equals(className) && "put".equals(methodName) && "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;".equals(methodSig)) { if (stack.getStackDepth() > 1) { OpcodeStack.Item itm = stack.getStackItem(1); String pushedSig = itm.getSignature(); if (pushedSig.charAt(0) == '[') found = true; } } else if ("java/util/Set".equals(className) && "add".equals(methodName) && "(Ljava/lang/Object;)Z".equals(methodSig)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); String pushedSig = itm.getSignature(); if (pushedSig.charAt(0) == '[') found = true; } } else if ("java/util/List".equals(className) && "contains".equals(methodName) && "(Ljava/lang/Object;)Z".equals(methodSig)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); String pushedSig = itm.getSignature(); if (pushedSig.charAt(0) == '[') found = true; } } if (found) { bugReporter.reportBug(new BugInstance(this, "ABC_ARRAY_BASED_COLLECTIONS", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); } } } finally { stack.sawOpcode(this, seen); } } } |
From: Dave B. <dbr...@us...> - 2005-12-17 08:27:09
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14091/samples Added Files: ABC_Sample.java Log Message: initial checkin - new ABC detector --- NEW FILE: ABC_Sample.java --- import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; public class ABC_Sample { public Map<String[], String> testMaps(String[] key, String value) { Map<String[], String> m = new HashMap<String[], String>(); m.put(key, value); return m; } public Set<String[]> testSets(String[] values) { Set<String[]> s = new HashSet<String[]>(); s.add(values); return s; } public boolean testLists(List<String[]> l, String[] value) { return l.contains(value); } } |
From: Dave B. <dbr...@us...> - 2005-12-17 04:31:09
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16902/src/com/mebigfatguy/fbcontrib/detect Modified Files: NeedlessAutoboxing.java Log Message: embellish the NAB detector to find BoxPrimitive.valueOf(BoxedPrimitive) Index: NeedlessAutoboxing.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- NeedlessAutoboxing.java 5 Dec 2005 05:21:15 -0000 1.3 +++ NeedlessAutoboxing.java 17 Dec 2005 04:31:01 -0000 1.4 @@ -35,14 +35,14 @@ private static final Map<String, String[]> boxClasses = new HashMap<String, String[]>(); static { - boxClasses.put("java/lang/Boolean", new String[] { "booleanValue()Z", "(Z)V" }); - boxClasses.put("java/lang/Character", new String[] { "charValue()C", "(C)V" }); - boxClasses.put("java/lang/Byte", new String[] { "byteValue()B", "(B)V" }); - boxClasses.put("java.lang/Short", new String[] { "shortValue()S", "(S)V" }); - boxClasses.put("java/lang/Integer", new String[] { "intValue()I", "(I)V" }); - boxClasses.put("java/lang/Long", new String[] { "longValue()J", "(J)V" }); - boxClasses.put("java/lang/Float", new String[] { "floatValue()F", "(F)V" }); - boxClasses.put("java/lang/Double", new String[] { "doubleValue()D", "(D)V" }); + boxClasses.put("java/lang/Boolean", new String[] { "booleanValue()Z", "(Z)V", "(Z)Ljava/lang/Boolean;" }); + boxClasses.put("java/lang/Character", new String[] { "charValue()C", "(C)V", "(C)Ljava/lang/Character;" }); + boxClasses.put("java/lang/Byte", new String[] { "byteValue()B", "(B)V", "(B)Ljava/lang/Byte;" }); + boxClasses.put("java.lang/Short", new String[] { "shortValue()S", "(S)V", "(S)Ljava/lang/Short;" }); + boxClasses.put("java/lang/Integer", new String[] { "intValue()I", "(I)V", "(I)Ljava/lang/Integer;" }); + boxClasses.put("java/lang/Long", new String[] { "longValue()J", "(J)V", "(J)Ljava/lang/Long;" }); + boxClasses.put("java/lang/Float", new String[] { "floatValue()F", "(F)V", "(F)Ljava/lang/Float;" }); + boxClasses.put("java/lang/Double", new String[] { "doubleValue()D", "(D)V", "(D)Ljava/lang/Double;" }); } private BugReporter bugReporter; @@ -102,6 +102,20 @@ } } } + } else if (seen == INVOKESTATIC) { + if (boxClass.equals(getClassConstantOperand())) { + String methodName = getNameConstantOperand(); + String boxSig = boxClasses.get(boxClass)[2]; + if ("valueOf".equals(methodName)) { + String methodSig = getSigConstantOperand(); + if (boxSig.equals(methodSig)) { + bugReporter.reportBug(new BugInstance(this, "NAB_NEEDLESS_AUTOBOXING", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } } state = SEEN_NOTHING; break; |
From: Dave B. <dbr...@us...> - 2005-12-17 04:31:09
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16902/samples Modified Files: NAB_Sample.java Log Message: embellish the NAB detector to find BoxPrimitive.valueOf(BoxedPrimitive) Index: NAB_Sample.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/samples/NAB_Sample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NAB_Sample.java 3 Dec 2005 03:33:24 -0000 1.1 +++ NAB_Sample.java 17 Dec 2005 04:31:00 -0000 1.2 @@ -1,7 +1,7 @@ public class NAB_Sample { - public void test() + public void testDupCtor() { Boolean bo = new Boolean(false); Boolean bbo = new Boolean(bo); @@ -20,4 +20,24 @@ Double d = new Double(0.0); Double dd = new Double(d); } + + public void testDupValueOf() + { + Boolean bo = new Boolean(false); + Boolean bbo = Boolean.valueOf(bo); + Byte b = new Byte((byte)0); + Byte bb = Byte.valueOf(b); + Character c = new Character('a'); + Character cc = Character.valueOf(c); + Short s = new Short((short) 0); + Short ss = Short.valueOf(s); + Integer i = new Integer(0); + Integer ii = Integer.valueOf(i); + Long l = new Long(0); + Long ll = Long.valueOf(l); + Float f = new Float(0.0f); + Float ff = Float.valueOf(f); + Double d = new Double(0.0); + Double dd = Double.valueOf(d); + } } |
From: Dave B. <dbr...@us...> - 2005-12-10 03:42:03
|
Update of /cvsroot/fb-contrib/fb-contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28822 Modified Files: build.xml Log Message: get ready for 1.9.0 development Index: build.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/build.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- build.xml 9 Dec 2005 04:37:19 -0000 1.21 +++ build.xml 10 Dec 2005 03:41:54 -0000 1.22 @@ -18,7 +18,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="1.8.0"/> + <property name="fb-contrib.version" value="1.9.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> |
From: Dave B. <dbr...@us...> - 2005-12-10 03:41:10
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28743/samples Modified Files: SMII_Sample.java Log Message: a possible test Index: SMII_Sample.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/samples/SMII_Sample.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SMII_Sample.java 17 Nov 2005 05:33:13 -0000 1.2 +++ SMII_Sample.java 10 Dec 2005 03:41:02 -0000 1.3 @@ -1,3 +1,5 @@ +import java.util.HashSet; +import java.util.Set; public class SMII_Sample @@ -29,4 +31,10 @@ { new SMII_Sample().getSMI().static_one("hello"); } + + public void test_dotclass() + { + Set s = new HashSet(); + s.add(String.class); + } } \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2005-12-09 04:58:59
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1476/htdocs Modified Files: index.html Log Message: sigh, more typos Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- index.html 9 Dec 2005 04:57:33 -0000 1.42 +++ index.html 9 Dec 2005 04:58:50 -0000 1.43 @@ -53,7 +53,7 @@ java.lang.Thread. Since the internal workings of the thread 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.</li> + when not intended, or removing 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 |
From: Dave B. <dbr...@us...> - 2005-12-09 04:57:40
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1286/htdocs Modified Files: index.html Log Message: fix grammar Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- index.html 9 Dec 2005 04:56:05 -0000 1.41 +++ index.html 9 Dec 2005 04:57:33 -0000 1.42 @@ -50,7 +50,7 @@ <ul> <li><b>Spurious Thread States</b><br/> Finds 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 + java.lang.Thread. Since the internal workings of the thread 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.</li> |
From: Dave B. <dbr...@us...> - 2005-12-09 04:56:15
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1085/htdocs Modified Files: index.html Log Message: get the flip states right, on the images Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- index.html 9 Dec 2005 04:37:19 -0000 1.40 +++ index.html 9 Dec 2005 04:56:05 -0000 1.41 @@ -44,7 +44,7 @@ <a href="http://www.sourceforge.net/projects/fb-contrib">Project Page</a> <hr/> - <img id="v1_8_0_image" src="flip1.gif" onClick="toggleBlock('v1_8_0', 'v1_8_0_image');" align="top"/> + <img id="v1_8_0_image" src="flip2.gif" onClick="toggleBlock('v1_8_0', 'v1_8_0_image');" align="top"/> Detectors added in v1_8_0<br/> <div id="v1_8_0" style="display:block;"> <ul> @@ -68,7 +68,7 @@ </div> <hr/> - <img id="v1_6_0_image" src="flip2.gif" onClick="toggleBlock('v1_6_0', 'v1_6_0_image');" align="top"/> + <img id="v1_6_0_image" src="flip1.gif" onClick="toggleBlock('v1_6_0', 'v1_6_0_image');" align="top"/> Detectors added in v1.6.0<br/> <div id="v1_6_0" style="display:none;"> <ul> |
From: Dave B. <dbr...@us...> - 2005-12-09 04:37:27
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31247/htdocs Modified Files: index.html Log Message: get ready for the v1_8_0 release Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- index.html 8 Dec 2005 03:54:40 -0000 1.39 +++ index.html 9 Dec 2005 04:37:19 -0000 1.40 @@ -44,10 +44,9 @@ <a href="http://www.sourceforge.net/projects/fb-contrib">Project Page</a> <hr/> - <img id="cvs_image" src="flip1.gif" onClick="toggleBlock('cvs', 'cvs_image');" align="top"/> - Detectors added in CVS<br/> - <div id="cvs" style="display:none;"> - Note: these detectors are still in testing + <img id="v1_8_0_image" src="flip1.gif" onClick="toggleBlock('v1_8_0', 'v1_8_0_image');" align="top"/> + Detectors added in v1_8_0<br/> + <div id="v1_8_0" style="display:block;"> <ul> <li><b>Spurious Thread States</b><br/> Finds methods that call wait, notify or notifyAll on an instance of a @@ -71,7 +70,7 @@ <hr/> <img id="v1_6_0_image" src="flip2.gif" onClick="toggleBlock('v1_6_0', 'v1_6_0_image');" align="top"/> Detectors added in v1.6.0<br/> - <div id="v1_6_0" style="display:block;"> + <div id="v1_6_0" style="display:none;"> <ul> <li><b>Static Method Instance Invocation</b><br/> Finds methods that make static method calls using an instance reference. |
From: Dave B. <dbr...@us...> - 2005-12-09 04:37:27
|
Update of /cvsroot/fb-contrib/fb-contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31247 Modified Files: build.xml Log Message: get ready for the v1_8_0 release Index: build.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/build.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- build.xml 5 Dec 2005 04:51:29 -0000 1.20 +++ build.xml 9 Dec 2005 04:37:19 -0000 1.21 @@ -18,7 +18,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="1.7.0"/> + <property name="fb-contrib.version" value="1.8.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> |
From: Dave B. <dbr...@us...> - 2005-12-09 04:24:17
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29417/src/com/mebigfatguy/fbcontrib/detect Modified Files: CopiedOverriddenMethod.java Log Message: can't get away with just comparing bytes... Now compare instruction by instruction. For most instructions, comparing instructions for sameness is ok, but for now, FieldInstructions be careful that it really is the same field in the same class. Others may show up, as well. Index: CopiedOverriddenMethod.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- CopiedOverriddenMethod.java 9 Dec 2005 02:33:37 -0000 1.2 +++ CopiedOverriddenMethod.java 9 Dec 2005 04:24:09 -0000 1.3 @@ -18,18 +18,23 @@ */ package com.mebigfatguy.fbcontrib.detect; -import java.util.Arrays; import java.util.HashMap; import java.util.Map; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; +import org.apache.bcel.generic.BranchInstruction; +import org.apache.bcel.generic.ConstantPoolGen; +import org.apache.bcel.generic.FieldInstruction; +import org.apache.bcel.generic.Instruction; +import org.apache.bcel.generic.InstructionHandle; +import org.apache.bcel.generic.InstructionList; +import org.apache.bcel.generic.ReferenceType; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.Detector; -import edu.umd.cs.findbugs.SourceLineAnnotation; import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; import edu.umd.cs.findbugs.visitclass.DismantleBytecode; @@ -40,6 +45,7 @@ private Map<String, Code> superclassCode = new HashMap<String, Code>(); private ClassContext classContext; private String curMethodInfo; + private ConstantPoolGen childPoolGen, parentPoolGen; /** * constructs a COM detector given the reporter to report bugs on @@ -73,6 +79,8 @@ this.classContext = classContext; superclassCode.clear(); JavaClass superCls = cls.getSuperClass(); + childPoolGen = new ConstantPoolGen(cls.getConstantPool()); + parentPoolGen = new ConstantPoolGen(superCls.getConstantPool()); Method[] methods = superCls.getMethods(); for (Method m : methods) { String methodName = m.getName(); @@ -85,6 +93,8 @@ } cls.accept(this); superclassCode.clear(); + childPoolGen = null; + parentPoolGen = null; } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); @@ -112,7 +122,7 @@ Code superCode = superclassCode.get(curMethodInfo); if (superCode != null) { - if (Arrays.equals(obj.getCode(), superCode.getCode())) { + if (codeEquals(obj, superCode)) { bugReporter.reportBug(new BugInstance(this, "COM_COPIED_OVERRIDDEN_METHOD", NORMAL_PRIORITY) .addClass(this) .addMethod(this) @@ -122,6 +132,65 @@ } /** + * compares two code blocks to see if they are equal with regard to instructions and field accesses + * + * @param code1 the first code block + * @param code2 the second code block + * + * @return whether the code blocks are the same + */ + public boolean codeEquals(Code child, Code parent) { + byte[] childBytes = child.getCode(); + byte[] parentBytes = parent.getCode(); + + if ((childBytes == null) || (parentBytes == null)) + return false; + + if (childBytes.length != parentBytes.length) + return false; + + InstructionHandle[] childihs = new InstructionList(childBytes).getInstructionHandles(); + InstructionHandle[] parentihs = new InstructionList(parentBytes).getInstructionHandles(); + + if (childihs.length != parentihs.length) + return false; + + for (int i = 0; i < childihs.length; i++) { + InstructionHandle childih = childihs[i]; + InstructionHandle parentih = parentihs[i]; + Instruction childin = childih.getInstruction(); + Instruction parentin = parentih.getInstruction(); + + if (!childin.getName().equals(parentin.getName())) + return false; + + if (childin instanceof FieldInstruction) { + String childFName = ((FieldInstruction) childin).getFieldName(childPoolGen); + String parentFName = ((FieldInstruction) parentin).getFieldName(parentPoolGen); + if (!childFName.equals(parentFName)) + return false; + String childFSig = ((FieldInstruction) childin).getSignature(childPoolGen); + String parentFSig = ((FieldInstruction) parentin).getSignature(parentPoolGen); + if (!childFSig.equals(parentFSig)) + return false; + + if (childFSig.charAt(0) == 'L') { + ReferenceType childRefType = ((FieldInstruction) childin).getReferenceType(childPoolGen); + ReferenceType parentRefType = ((FieldInstruction) parentin).getReferenceType(parentPoolGen); + if (!childRefType.getSignature().equals(parentRefType.getSignature())) + return false; + } + } else { + if (!childin.equals(parentin)) + return false; + } + + } + + return true; + } + + /** * implements the detector with an empty implementation */ public void report() { |
From: Dave B. <dbr...@us...> - 2005-12-09 02:33:44
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9130/src/com/mebigfatguy/fbcontrib/detect Modified Files: CopiedOverriddenMethod.java Log Message: rule out abstract methods Index: CopiedOverriddenMethod.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CopiedOverriddenMethod.java 8 Dec 2005 03:47:01 -0000 1.1 +++ CopiedOverriddenMethod.java 9 Dec 2005 02:33:37 -0000 1.2 @@ -77,6 +77,7 @@ for (Method m : methods) { String methodName = m.getName(); if ((m.isPublic() || m.isProtected()) + && (!m.isAbstract()) && (!"<init>".equals(methodName) && !"<clinit>".equals(methodName))) { String methodInfo = methodName + ":" + m.getSignature(); superclassCode.put(methodInfo, m.getCode()); @@ -106,7 +107,7 @@ */ public void visitCode(Code obj) { Method m = getMethod(); - if (!m.isPublic() && !m.isProtected()) + if (!m.isPublic() && !m.isProtected() && !m.isAbstract()) return; Code superCode = superclassCode.get(curMethodInfo); |
From: Dave B. <dbr...@us...> - 2005-12-08 03:54:49
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4297/htdocs Modified Files: index.html Log Message: typo Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- index.html 8 Dec 2005 03:46:59 -0000 1.38 +++ index.html 8 Dec 2005 03:54:40 -0000 1.39 @@ -62,7 +62,7 @@ <li><b>UnnecessaryStoreBeforeReturn</b><br/> Finds methods that store the return result in a local variable, and then immediately returns that local variable.</li> - >li><b>CopiedOverriddenMethod</b><br/> + <li><b>CopiedOverriddenMethod</b><br/> Finds methods that are implemented with an exact copy of their super class method's implementation. In most cases, this means that this method can just be removed.</li> </ul> |
From: Dave B. <dbr...@us...> - 2005-12-08 03:47:16
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3152/htdocs Modified Files: index.html Log Message: initial check in - new COM detector Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- index.html 3 Dec 2005 16:55:18 -0000 1.37 +++ index.html 8 Dec 2005 03:46:59 -0000 1.38 @@ -62,6 +62,9 @@ <li><b>UnnecessaryStoreBeforeReturn</b><br/> Finds methods that store the return result in a local variable, and then immediately returns that local variable.</li> + >li><b>CopiedOverriddenMethod</b><br/> + Finds methods that are implemented with an exact copy of their super class method's + implementation. In most cases, this means that this method can just be removed.</li> </ul> </div> |
From: Dave B. <dbr...@us...> - 2005-12-08 03:47:15
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3152/src/com/mebigfatguy/fbcontrib/detect Added Files: CopiedOverriddenMethod.java Log Message: initial check in - new COM detector --- NEW FILE: CopiedOverriddenMethod.java --- /* * 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.Arrays; import java.util.HashMap; import java.util.Map; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.Detector; import edu.umd.cs.findbugs.SourceLineAnnotation; import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; import edu.umd.cs.findbugs.visitclass.DismantleBytecode; public class CopiedOverriddenMethod extends DismantleBytecode implements Detector, StatelessDetector { private BugReporter bugReporter; private Map<String, Code> superclassCode = new HashMap<String, Code>(); private ClassContext classContext; private String curMethodInfo; /** * constructs a COM detector given the reporter to report bugs on * @param bugReporter the sync of bug reports */ public CopiedOverriddenMethod(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 accept classes derived from non java.lang.Object classes. * * @param classContext the context object of the currently parsed class */ public void visitClassContext(ClassContext classContext) { try { JavaClass cls = classContext.getJavaClass(); String superName = cls.getSuperclassName(); if (!"java.lang.Object".equals(superName)) { this.classContext = classContext; superclassCode.clear(); JavaClass superCls = cls.getSuperClass(); Method[] methods = superCls.getMethods(); for (Method m : methods) { String methodName = m.getName(); if ((m.isPublic() || m.isProtected()) && (!"<init>".equals(methodName) && !"<clinit>".equals(methodName))) { String methodInfo = methodName + ":" + m.getSignature(); superclassCode.put(methodInfo, m.getCode()); } } cls.accept(this); superclassCode.clear(); } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } /** * overrides the visitor to get the methodInfo * * @param obj the method object for the currently parsed method */ public void visitMethod(Method obj) { curMethodInfo = obj.getName() + ":" + obj.getSignature(); } /** * overrides the visitor to find code blocks of methods that are the same as its parents * * @param obj the code object of the currently parsed method */ public void visitCode(Code obj) { Method m = getMethod(); if (!m.isPublic() && !m.isProtected()) return; Code superCode = superclassCode.get(curMethodInfo); if (superCode != null) { if (Arrays.equals(obj.getCode(), superCode.getCode())) { bugReporter.reportBug(new BugInstance(this, "COM_COPIED_OVERRIDDEN_METHOD", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(classContext, this, getPC())); } } } /** * implements the detector with an empty implementation */ public void report() { } } |
From: Dave B. <dbr...@us...> - 2005-12-08 03:47:15
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3152/etc Modified Files: findbugs.xml messages.xml Log Message: initial check in - new COM detector Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- messages.xml 3 Dec 2005 16:46:47 -0000 1.35 +++ messages.xml 8 Dec 2005 03:46:59 -0000 1.36 @@ -315,6 +315,16 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod"> + <Details> + <![CDATA[ + <p>Looks for methods that are direct copies of the implementation in the super class</p> + </p> + <p>It is a moderately fast detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -603,6 +613,18 @@ </Details> </BugPattern> + <BugPattern type="COM_COPIED_OVERRIDDEN_METHOD"> + <ShortDescription>method is implemented with an exact copy of it's superclass's method</ShortDescription> + <LongDescription>method {1} is implemented with an exact copy of it's superclass's method</LongDescription> + <Details> + <![CDATA[ + <p>This method is implemented using an exact copy of it's super class method's + implementation, which usually means that this method can just be removed. + </p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -628,4 +650,5 @@ <BugCode abbrev="STS">Spurious Thread States</BugCode> <BugCode abbrev="NAB">Needless Autoboxing</BugCode> <BugCode abbrev="USBR">Unnecessary Store Before Return</BugCode> + <BugCode abbrev="COM">Copied Overridden Method</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.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- findbugs.xml 3 Dec 2005 16:46:47 -0000 1.42 +++ findbugs.xml 8 Dec 2005 03:46:59 -0000 1.43 @@ -105,6 +105,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn" speed="fast" reports="USBR_UNNECESSARY_STORE_BEFORE_RETURN" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod" + speed="moderate" + reports="COM_COPIED_OVERRIDDEN_METHOD" /> <!-- BugPattern --> @@ -131,4 +135,5 @@ <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" /> + <BugPattern abbrev="COM" type="COM_COPIED_OVERRIDDEN_METHOD" category="STYLE" experimental="true" /> </FindbugsPlugin> \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2005-12-08 03:47:15
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3152/samples Added Files: COM_Sample.java Log Message: initial check in - new COM detector --- NEW FILE: COM_Sample.java --- import java.util.HashSet; import java.util.Set; public class COM_Sample { public void test1() { } public String test2(int i) { return String.valueOf(i); } public Set<String> test3(String a, String b, String c) { Set<String> ss = new HashSet<String>(); ss.add(a); ss.add(b); ss.add(c); return ss; } public static class Derived extends COM_Sample { public void test1() { } public Set<String> test3(String a, String b, String c) { Set<String> ss = new HashSet<String>(); ss.add(a); ss.add(b); ss.add(c); return ss; } public String test2(int i) { return String.valueOf(i); } } } |
From: Dave B. <dbr...@us...> - 2005-12-06 06:57:32
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26880/src/com/mebigfatguy/fbcontrib/detect Modified Files: LiteralStringComparison.java Log Message: javadoc Index: LiteralStringComparison.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- LiteralStringComparison.java 5 Dec 2005 05:21:15 -0000 1.5 +++ LiteralStringComparison.java 6 Dec 2005 06:57:22 -0000 1.6 @@ -49,12 +49,22 @@ return super.clone(); } + /** + * overrides the visitor to reset the opcode stack + * + * @param obj the code object for the currently parsed method + */ @Override public void visitCode(final Code obj) { stack.resetForMethodEntry(this); super.visitCode(obj); } + /** + * looks for strings comparisons where the stack object is a literal + * + * @param seen the currently parsed opcode + */ @Override public void sawOpcode(final int seen) { try { |
From: Dave B. <dbr...@us...> - 2005-12-06 06:56:02
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26665/src/com/mebigfatguy/fbcontrib/detect Modified Files: ListIndexedIterating.java Log Message: javadoc Index: ListIndexedIterating.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ListIndexedIterating.java 5 Dec 2005 05:21:15 -0000 1.9 +++ ListIndexedIterating.java 6 Dec 2005 06:55:53 -0000 1.10 @@ -71,6 +71,11 @@ return super.clone(); } + /** + * overrides the visitor to reset the opcode stack + * + * @param obj the code object for the currently parsed Code + */ @Override public void visitCode(final Code obj) { sawListSize = false; @@ -88,6 +93,11 @@ } } + /** + * overrides the visitor to find list indexed iterating + * + * @param seen the currently parsed opcode + */ @Override public void sawOpcode(final int seen) { if (stage == FIND_LOOP_STAGE) @@ -96,6 +106,11 @@ sawOpcodeBug(seen); } + /** + * the first pass of the method opcode to collet for loops information + * + * @param seen the currently parsed opcode + */ private void sawOpcodeLoop(final int seen) { try { switch (state) { @@ -129,6 +144,11 @@ } } + /** + * the second pass to look for get methods on the for loop reg + * + * @param seen the currently parsed opcode + */ private void sawOpcodeBug(final int seen) { try { Iterator<ForLoop> it = possibleForLoops.iterator(); @@ -214,12 +234,24 @@ } } + /** + * get the register operand from the passed in opcode + * + * @param seen the currently parsed opcode + * @param generalOp the standard non numbered operand + * @param zeroOp the base opcode from which to calculate the register + * + * @return the register operand for the instruction + */ private int getReg(final int seen, final int generalOp, final int zeroOp) { if (seen == generalOp) return getRegisterOperand(); return seen - zeroOp; } + /** + * represents a for loop + */ static class ForLoop { private int loopStart; @@ -229,6 +261,13 @@ private boolean loopRegLoaded; private OpcodeStack.Item loopCollectionItem; + /** + * constructs a for loop information block + * + * @param start the start of the for loop + * @param end the end of the for loop + * @param reg the loop register + */ public ForLoop( final int start, final int end, final int reg) { loopStart = start; loopEnd = end; @@ -238,34 +277,76 @@ loopCollectionItem = null; } + /** + * get the start pc of the loop + * + * @return the start pc of the loop + */ public int getLoopStart() { return loopStart; } + /** + * get the end pc of the loop + * + * @return the end pc of the loop + */ public int getLoopEnd() { return loopEnd; } + /** + * get the loop register + * + * @return the loop register + */ public int getLoopReg() { return loopReg; } + /** + * sets the current state of the for loop + * + * @param state the new state + */ public void setLoopState(final int state) { loopState = state; } + /** + * get the current phase of the for loop + * + * @return the current state + */ public int getLoopState() { return loopState; } + /** + * mark that the loop register has been loaded with an iload instruction + * + * @param loaded the flag of whether the loop register is loaded + */ public void setLoopRegLoaded(final boolean loaded) { loopRegLoaded = loaded; } + /** + * returns whether the loop register is on the top of the stack + * + * @return whether the loop register is on the top of the stack + */ public boolean getLoopRegLoaded() { return loopRegLoaded; } + /** + * returns whether this is the second time the loop register is found + * + * @param itm the item on the stack + * + * @return whether this is the second time the loop register is found + */ public boolean isSecondItem(OpcodeStack.Item itm) { if (loopCollectionItem == null) { loopCollectionItem = itm; |
From: Dave B. <dbr...@us...> - 2005-12-06 05:55:52
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15075/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.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ConfusingAutoboxedOverloading.java 6 Dec 2005 05:38:31 -0000 1.5 +++ ConfusingAutoboxedOverloading.java 6 Dec 2005 05:55:44 -0000 1.6 @@ -68,7 +68,7 @@ /** * overrides the visitor to look for confusing signatures * - * @param classContent the context object that holds the JavaClass currently being parsed + * @param classContext the context object that holds the JavaClass currently being parsed */ public void visitClassContext(ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); |
From: Dave B. <dbr...@us...> - 2005-12-06 05:54:04
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14739/src/com/mebigfatguy/fbcontrib/detect Modified Files: FinalParameters.java Log Message: javadoc Index: FinalParameters.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- FinalParameters.java 5 Dec 2005 05:21:15 -0000 1.9 +++ FinalParameters.java 6 Dec 2005 05:53:56 -0000 1.10 @@ -74,12 +74,22 @@ return super.clone(); } + /** + * overrides the visitor to initialize the 'has source' flag + * + * @param classContext the context object for the currently parsed class + */ @Override public void visitClassContext(ClassContext classContext) { srcInited = false; super.visitClassContext(classContext); } + /** + * overrides the visitor capture source lines for the method + * + * @param obj the method object for the currently parsed method + */ @Override public void visitMethod(final Method obj) { methodName = obj.getName(); @@ -95,6 +105,13 @@ super.visitMethod(obj); } + /** + * reads the sourcefile based on the source line annotation for the method + * + * @param obj the method object for the currently parsed method + * + * @return an array of source lines for the method + */ private String[] getSourceLines(Method obj) { BufferedReader sourceReader = null; @@ -131,6 +148,11 @@ return sourceLines; } + /** + * overrides the visitor to find the source lines for the method header, to find non final parameters + * + * @param obj the code object for the currently parsed method + */ @Override public void visitCode(final Code obj) { if (sourceLines == null) @@ -189,6 +211,11 @@ } } + /** + * overrides the visitor to find local variable reference stores to store them as changed + * + * @param seen the currently parsed opcode + */ @Override public void sawOpcode(final int seen) { if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { @@ -198,6 +225,14 @@ } } + /** + * returns the variable name of the specified register slot + * + * @param obj the currently parsed code object + * @param reg the variable register of interest + * + * @return the variable name of the specified register + */ private String getRegisterName(final Code obj, final int reg) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { @@ -208,6 +243,13 @@ return String.valueOf(reg); } + /** + * return the register number that is be stored + * + * @param seen the opcode of the currently parsed statement + * + * @return the register number being stored + */ private int getAStoreParameter(final int seen) { int reg; if (seen == ASTORE) |
From: Dave B. <dbr...@us...> - 2005-12-06 05:48:28
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13651/src/com/mebigfatguy/fbcontrib/detect Modified Files: DubiousListCollection.java Log Message: javadoc Index: DubiousListCollection.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- DubiousListCollection.java 5 Dec 2005 05:21:15 -0000 1.8 +++ DubiousListCollection.java 6 Dec 2005 05:48:21 -0000 1.9 @@ -70,6 +70,11 @@ this.bugReporter = bugReporter; } + /** + * overrides the visitor to accept classes that define List based fields + * + * @param classContext the context object for the currently parsed class + */ @Override public void visitClassContext(final ClassContext classContext) { JavaClass cls = classContext.getJavaClass(); @@ -90,12 +95,23 @@ } } + /** + * overrides the visitor to reset the opcode stack object + * + * @param obj the code object for the currently parse method + */ @Override public void visitCode(final Code obj) { stack.resetForMethodEntry(this); super.visitCode(obj); } + /** + * overrides the visitor to record all method calls on List fields. If a method + * is not a set based method, remove it from further consideration + * + * @param seen the current opcode parsed. + */ @Override public void sawOpcode(final int seen) { try { @@ -134,7 +150,16 @@ stack.sawOpcode(this, seen); } } - + + /** + * return the field object that the current method was called on, by finding the reference + * down in the stack based on the number of parameters + * + * @param stk the opcode stack where fields are stored + * @param signature the signature of the called method + * + * @return the field annotation for the field whose method was executed + */ private FieldAnnotation getFieldFromStack(final OpcodeStack stk, final String signature) { int parmCount = Type.getArgumentTypes(signature).length; if (stk.getStackDepth() > parmCount) { @@ -144,6 +169,9 @@ return null; } + /** + * implements the detector, by reporting all remaining fields that only have set based access + */ private void reportBugs() { for (Map.Entry<String, Integer> entry : fieldsReported.entrySet()) { String field = entry.getKey(); @@ -159,6 +187,13 @@ } } + /** + * builds a field annotation by finding the field in the classes' field list + * + * @param fieldName the field for which to built the field annotation + * + * @return the field annotation of the specified field + */ private FieldAnnotation getFieldAnnotation(final String fieldName) { JavaClass cls = getClassContext().getJavaClass(); Field[] fields = cls.getFields(); |
From: Dave B. <dbr...@us...> - 2005-12-06 05:42:52
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12663/src/com/mebigfatguy/fbcontrib/detect Modified Files: DeclaredRuntimeException.java Log Message: javadoc Index: DeclaredRuntimeException.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- DeclaredRuntimeException.java 5 Dec 2005 05:21:15 -0000 1.7 +++ DeclaredRuntimeException.java 6 Dec 2005 05:42:44 -0000 1.8 @@ -67,11 +67,21 @@ return super.clone(); } + /** + * overrides the visitor and accepts if the Exception class was loaded + * + * @param classContext the context object for the currently parsed class + */ public void visitClassContext(final ClassContext classContext) { if (runtimeExceptionClass != null) classContext.getJavaClass().accept(this); } + /** + * overrides the visitor to find declared runtime exceptions + * + * @param obj the method object of the currently parsed method + */ @Override public void visitMethod(final Method obj) { ExceptionTable et = obj.getExceptionTable(); @@ -120,6 +130,9 @@ } } + /** + * implementation of the detector, with null implementation + */ public void report() { } |