fb-contrib-commit Mailing List for fb-contrib (Page 36)
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: <dbr...@us...> - 2007-11-10 03:26:04
|
Revision: 966 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=966&view=rev Author: dbrosius Date: 2007-11-09 19:26:09 -0800 (Fri, 09 Nov 2007) Log Message: ----------- document cfs Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2007-11-10 00:52:21 UTC (rev 965) +++ trunk/fb-contrib/htdocs/index.html 2007-11-10 03:26:09 UTC (rev 966) @@ -48,6 +48,19 @@ <a href="bugdescriptions.html">Bug Descriptions</a> <hr/> + <img id="svn_image" src="flip1.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> + Detectors added in svn<br/> + <div id="svn" style="display:none;"> + <ul> + <li><b>[CFS] Confusing Function Semantics</b><br/> + Looks for methods that return a parameter after making what looks like + modifications to that parameter. This leads to confusing on the user of this + method as it isn't obvious that the 'original' object is modified. If the + point of this method is to modify the parameter, it is probably better just + to have the method be a void method, to avoid confusion.</li> + </ul> + </div> + <hr/> <img id="v3_4_0_image" src="flip2.gif" onClick="toggleBlock('v3_4_0', 'v3_4_0_image');" align="top"/> Detectors add in v3.4.0<br/> <div id="v3_4_0" style="display:block;"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-10 00:52:18
|
Revision: 965 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=965&view=rev Author: dbrosius Date: 2007-11-09 16:52:21 -0800 (Fri, 09 Nov 2007) Log Message: ----------- handle negative branches Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-10 00:37:31 UTC (rev 964) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-10 00:52:21 UTC (rev 965) @@ -124,18 +124,18 @@ if ((seen == IFEQ) || (seen == IFLE) || (seen == IFNE)) { if (lastLoadWasString && (lastPCs[0] != -1)) { byte[] bytes = getCode().getCode(); - int loadIns = get1Byte(bytes, lastPCs[2]); + int loadIns = getbyte(bytes, lastPCs[2]); int brOffset = (loadIns == ALOAD) ? 11 : 10; if ((((loadIns >= ALOAD_0) && (loadIns <= ALOAD_3)) || (loadIns == ALOAD)) - && (get1Byte(bytes, lastPCs[3]) == INVOKEVIRTUAL) - && (get1Byte(bytes, lastPCs[2]) == loadIns) - && (get1Byte(bytes, lastPCs[1]) == IFNULL) - && (get1Byte(bytes, lastPCs[0]) == loadIns) - && ((loadIns != ALOAD) || (get1Byte(bytes, lastPCs[2]+1) == get1Byte(bytes, lastPCs[0]+1))) - && ((seen == IFNE) ? get2Bytes(bytes, lastPCs[1]+1) > brOffset : get2Bytes(bytes, lastPCs[1]+1) == brOffset)) { + && (getbyte(bytes, lastPCs[3]) == INVOKEVIRTUAL) + && (getbyte(bytes, lastPCs[2]) == loadIns) + && (getbyte(bytes, lastPCs[1]) == IFNULL) + && (getbyte(bytes, lastPCs[0]) == loadIns) + && ((loadIns != ALOAD) || (getbyte(bytes, lastPCs[2]+1) == getbyte(bytes, lastPCs[0]+1))) + && ((seen == IFNE) ? getshort(bytes, lastPCs[1]+1) > brOffset : getshort(bytes, lastPCs[1]+1) == brOffset)) { ConstantPool pool = getConstantPool(); - int mpoolIndex = get2Bytes(bytes, lastPCs[3]+1); + int mpoolIndex = getshort(bytes, lastPCs[3]+1); ConstantMethodref cmr = (ConstantMethodref)pool.getConstant(mpoolIndex); int nandtIndex = cmr.getNameAndTypeIndex(); ConstantNameAndType cnt = (ConstantNameAndType)pool.getConstant(nandtIndex); @@ -406,13 +406,14 @@ } } - private int get1Byte(byte[] bytes, int offset) + private int getbyte(byte[] bytes, int offset) { return (0x00FF & bytes[offset]); } - private int get2Bytes(byte[] bytes, int offset) + private int getshort(byte[] bytes, int offset) { - return (0x0000FFFF & (bytes[offset] << 8)) | (0x00FF & bytes[offset+1]); + short s = (short)((0x0000FFFF & (bytes[offset] << 8)) | (0x00FF & bytes[offset+1])); + return s; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-10 00:37:31
|
Revision: 964 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=964&view=rev Author: dbrosius Date: 2007-11-09 16:37:31 -0800 (Fri, 09 Nov 2007) Log Message: ----------- more fps Modified Paths: -------------- trunk/fb-contrib/samples/SPP_Sample.java Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2007-11-09 02:18:54 UTC (rev 963) +++ trunk/fb-contrib/samples/SPP_Sample.java 2007-11-10 00:37:31 UTC (rev 964) @@ -1,5 +1,8 @@ import java.math.BigDecimal; import java.util.BitSet; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; public class SPP_Sample { @@ -139,5 +142,18 @@ if ((e != null) && (e.length() != 0)) System.out.println("Booya"); + + Set<String> m = new HashSet<String>(); + Iterator<String> it = m.iterator(); + while (it.hasNext()) + { + s = it.next(); + if ((s == null) || (s.length() == 0)) + { + continue; + } + + System.out.println("Booya"); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-09 02:18:50
|
Revision: 963 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=963&view=rev Author: dbrosius Date: 2007-11-08 18:18:54 -0800 (Thu, 08 Nov 2007) Log Message: ----------- better documentation Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2007-11-08 23:29:23 UTC (rev 962) +++ trunk/fb-contrib/etc/messages.xml 2007-11-09 02:18:54 UTC (rev 963) @@ -1901,8 +1901,14 @@ <Details> <![CDATA[ <p>This method tests a string, and groups null values with real strings, leaving empty strings as another - case. This might be perfectly valid, but normally, null strings and empty strings are logically handled the same, + case. This might be perfectly valid, but normally, null strings and empty strings are logically handled the same way, and so this test may be flawed.</p> + <p>Pattern found is one of the following + <pre>if ((s == null) || (s.length() > 0))</pre> -- did you mean ((s == null) || (s.length() == 0))? + <pre>if ((s == null) || (s.length() != 0))</pre> -- did you mean ((s == null) || (s.length() == 0))? + <pre>if ((s != null) && (s.length() == 0))</pre> -- did you mean ((s != null) && (s.length() > 0))? + or perhaps ((s == null) || (s.length() == 0))? + </p> ]]> </Details> </BugPattern> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-08 23:29:21
|
Revision: 962 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=962&view=rev Author: dbrosius Date: 2007-11-08 15:29:23 -0800 (Thu, 08 Nov 2007) Log Message: ----------- more tests Modified Paths: -------------- trunk/fb-contrib/samples/SPP_Sample.java Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2007-11-08 23:03:56 UTC (rev 961) +++ trunk/fb-contrib/samples/SPP_Sample.java 2007-11-08 23:29:23 UTC (rev 962) @@ -99,17 +99,45 @@ public void testSuspiciousStringTests(String s) { + int a = 0, b = 0, c = 0, d = 0; + String e = "Foo"; + if ((s == null) || (s.length() > 0)) System.out.println("Booya"); if ((s == null) || (s.length() != 0)) System.out.println("Booya"); if ((s != null) && (s.length() == 0)) System.out.println("Booya"); + + if ((e == null) || (e.length() > 0)) + System.out.println("Booya"); + if ((e == null) || (e.length() != 0)) + System.out.println("Booya"); + if ((e != null) && (e.length() == 0)) + System.out.println("Booya"); } public void testFPSST(String s) { + int a = 0, b = 0, c = 0, d = 0; + String e = "Foo"; + if ((s == null) || (s.length() == 0)) System.out.println("Booya"); + + if ((s != null) && (s.length() >= 0)) + System.out.println("Booya"); + + if ((s != null) && (s.length() != 0)) + System.out.println("Booya"); + + if ((e == null) || (e.length() == 0)) + System.out.println("Booya"); + + if ((e != null) && (e.length() >= 0)) + System.out.println("Booya"); + + if ((e != null) && (e.length() != 0)) + System.out.println("Booya"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-08 23:03:52
|
Revision: 961 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=961&view=rev Author: dbrosius Date: 2007-11-08 15:03:56 -0800 (Thu, 08 Nov 2007) Log Message: ----------- remove fps Modified Paths: -------------- trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2007-11-08 06:31:38 UTC (rev 960) +++ trunk/fb-contrib/samples/SPP_Sample.java 2007-11-08 23:03:56 UTC (rev 961) @@ -106,4 +106,10 @@ if ((s != null) && (s.length() == 0)) System.out.println("Booya"); } + + public void testFPSST(String s) + { + if ((s == null) || (s.length() == 0)) + System.out.println("Booya"); + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-08 06:31:38 UTC (rev 960) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-08 23:03:56 UTC (rev 961) @@ -1,5 +1,5 @@ /* - * fb-contrib - Auxilliary detectors for Java programs + * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2007 Dave Brosius * * This library is free software; you can redistribute it and/or @@ -49,7 +49,7 @@ */ public class SillynessPotPourri extends BytecodeScanningDetector { - private BugReporter bugReporter; + private final BugReporter bugReporter; private OpcodeStack stack; private int lastPCs[]; private int lastOpcode; @@ -125,14 +125,15 @@ if (lastLoadWasString && (lastPCs[0] != -1)) { byte[] bytes = getCode().getCode(); int loadIns = get1Byte(bytes, lastPCs[2]); - + int brOffset = (loadIns == ALOAD) ? 11 : 10; + if ((((loadIns >= ALOAD_0) && (loadIns <= ALOAD_3)) || (loadIns == ALOAD)) && (get1Byte(bytes, lastPCs[3]) == INVOKEVIRTUAL) && (get1Byte(bytes, lastPCs[2]) == loadIns) && (get1Byte(bytes, lastPCs[1]) == IFNULL) && (get1Byte(bytes, lastPCs[0]) == loadIns) && ((loadIns != ALOAD) || (get1Byte(bytes, lastPCs[2]+1) == get1Byte(bytes, lastPCs[0]+1))) - && ((seen == IFNE) ? get2Bytes(bytes, lastPCs[1]+1) > 10 : get2Bytes(bytes, lastPCs[1]+1) == 10)) { + && ((seen == IFNE) ? get2Bytes(bytes, lastPCs[1]+1) > brOffset : get2Bytes(bytes, lastPCs[1]+1) == brOffset)) { ConstantPool pool = getConstantPool(); int mpoolIndex = get2Bytes(bytes, lastPCs[3]+1); ConstantMethodref cmr = (ConstantMethodref)pool.getConstant(mpoolIndex); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-08 06:31:34
|
Revision: 960 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=960&view=rev Author: dbrosius Date: 2007-11-07 22:31:38 -0800 (Wed, 07 Nov 2007) Log Message: ----------- add SPP_SUSPECT_STRING_TEST bug pattern Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2007-11-07 07:16:36 UTC (rev 959) +++ trunk/fb-contrib/etc/findbugs.xml 2007-11-08 06:31:38 UTC (rev 960) @@ -256,7 +256,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" speed="fast" - reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY" /> + reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST" /> <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" speed="fast" @@ -387,6 +387,7 @@ <BugPattern abbrev="SPP" type="SPP_INVALID_BOOLEAN_NULL_CHECK" category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_USE_CHARAT" category="PERFORMANCE" /> <BugPattern abbrev="SPP" type="SPP_USELESS_TRINARY" category="PERFORMANCE" /> + <BugPattern abbrev="SPP" type="SPP_SUSPECT_STRING_TEST" category="CORRECTNESS" /> <BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" /> <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" /> <BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2007-11-07 07:16:36 UTC (rev 959) +++ trunk/fb-contrib/etc/messages.xml 2007-11-08 06:31:38 UTC (rev 960) @@ -1895,6 +1895,18 @@ </Details> </BugPattern> + <BugPattern type="SPP_SUSPECT_STRING_TEST"> + <ShortDescription>Method treats null and normal strings differently than an empty strings</ShortDescription> + <LongDescription>Method {1} treats null and normal strings differently than an empty strings</LongDescription> + <Details> + <![CDATA[ + <p>This method tests a string, and groups null values with real strings, leaving empty strings as another + case. This might be perfectly valid, but normally, null strings and empty strings are logically handled the same, + and so this test may be flawed.</p> + ]]> + </Details> + </BugPattern> + <BugPattern type="BAS_BLOATED_ASSIGNMENT_SCOPE"> <ShortDescription>Method assigns a variable in a larger scope then is needed</ShortDescription> <LongDescription>Method {1} assigns a variable in a larger scope then is needed</LongDescription> Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2007-11-07 07:16:36 UTC (rev 959) +++ trunk/fb-contrib/samples/SPP_Sample.java 2007-11-08 06:31:38 UTC (rev 960) @@ -96,4 +96,14 @@ { return (s.length() != 0); } + + public void testSuspiciousStringTests(String s) + { + if ((s == null) || (s.length() > 0)) + System.out.println("Booya"); + if ((s == null) || (s.length() != 0)) + System.out.println("Booya"); + if ((s != null) && (s.length() == 0)) + System.out.println("Booya"); + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-07 07:16:36 UTC (rev 959) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-08 06:31:38 UTC (rev 960) @@ -27,7 +27,12 @@ import org.apache.bcel.Repository; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.ConstantDouble; +import org.apache.bcel.classfile.ConstantMethodref; +import org.apache.bcel.classfile.ConstantNameAndType; +import org.apache.bcel.classfile.ConstantPool; import org.apache.bcel.classfile.JavaClass; +import org.apache.bcel.classfile.LocalVariable; +import org.apache.bcel.classfile.LocalVariableTable; import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; @@ -37,6 +42,7 @@ import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.ba.ClassContext; +import edu.umd.cs.findbugs.visitclass.LVTHelper; /** * looks for silly bugs that are simple but do not fit into one large pattern. @@ -49,6 +55,7 @@ private int lastOpcode; private int lastReg; private boolean lastIfEqWasBoolean; + private boolean lastLoadWasString; /** branch targets, to a set of branch instructions */ private Map<Integer, Set<Integer>> branchTargets; @@ -85,6 +92,7 @@ lastOpcode = -1; lastReg = -1; lastIfEqWasBoolean = false; + lastLoadWasString = false; Arrays.fill(lastPCs, -1); branchTargets.clear(); super.visitCode(obj); @@ -113,6 +121,34 @@ branchInsSet.add(Integer14.valueOf(getPC())); } + if ((seen == IFEQ) || (seen == IFLE) || (seen == IFNE)) { + if (lastLoadWasString && (lastPCs[0] != -1)) { + byte[] bytes = getCode().getCode(); + int loadIns = get1Byte(bytes, lastPCs[2]); + + if ((((loadIns >= ALOAD_0) && (loadIns <= ALOAD_3)) || (loadIns == ALOAD)) + && (get1Byte(bytes, lastPCs[3]) == INVOKEVIRTUAL) + && (get1Byte(bytes, lastPCs[2]) == loadIns) + && (get1Byte(bytes, lastPCs[1]) == IFNULL) + && (get1Byte(bytes, lastPCs[0]) == loadIns) + && ((loadIns != ALOAD) || (get1Byte(bytes, lastPCs[2]+1) == get1Byte(bytes, lastPCs[0]+1))) + && ((seen == IFNE) ? get2Bytes(bytes, lastPCs[1]+1) > 10 : get2Bytes(bytes, lastPCs[1]+1) == 10)) { + ConstantPool pool = getConstantPool(); + int mpoolIndex = get2Bytes(bytes, lastPCs[3]+1); + ConstantMethodref cmr = (ConstantMethodref)pool.getConstant(mpoolIndex); + int nandtIndex = cmr.getNameAndTypeIndex(); + ConstantNameAndType cnt = (ConstantNameAndType)pool.getConstant(nandtIndex); + if ("length".equals(cnt.getName(pool))) { + bugReporter.reportBug(new BugInstance(this, "SPP_SUSPECT_STRING_TEST", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } + } + + if (seen == IFEQ) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); @@ -185,7 +221,7 @@ .addSourceLine(this)); } } - } else if (((seen >= ASTORE_0) && (seen < ASTORE_3)) || (seen == ASTORE)) { + } else if (((seen >= ASTORE_0) && (seen <= ASTORE_3)) || (seen == ASTORE)) { reg = RegisterUtils.getAStoreReg(this, seen); if (seen == lastOpcode) { if (reg == lastReg) { @@ -195,6 +231,15 @@ .addSourceLine(this)); } } + } else if (((seen >= ALOAD_0) && (seen <= ASTORE_3)) || (seen == ALOAD)) { + lastLoadWasString = false; + LocalVariableTable lvt = getMethod().getLocalVariableTable(); + if (lvt != null) { + LocalVariable lv = LVTHelper.getLocalVariableAtPC(lvt, RegisterUtils.getALoadReg(this, seen), getPC()); + if (lv != null) { + lastLoadWasString = "Ljava/lang/String;".equals(lv.getSignature()); + } + } } else if ((seen >= ICONST_0) && (seen <= ICONST_3)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); @@ -359,4 +404,14 @@ lastPCs[3] = getPC(); } } + + private int get1Byte(byte[] bytes, int offset) + { + return (0x00FF & bytes[offset]); + } + + private int get2Bytes(byte[] bytes, int offset) + { + return (0x0000FFFF & (bytes[offset] << 8)) | (0x00FF & bytes[offset+1]); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-07 07:16:32
|
Revision: 959 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=959&view=rev Author: dbrosius Date: 2007-11-06 23:16:36 -0800 (Tue, 06 Nov 2007) Log Message: ----------- go back to 3.6.0 development Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2007-11-07 07:08:48 UTC (rev 958) +++ trunk/fb-contrib/build.xml 2007-11-07 07:16:36 UTC (rev 959) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="3.4.1"/> + <property name="fb-contrib.version" value="3.5.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2007-11-07 07:08:48 UTC (rev 958) +++ trunk/fb-contrib/etc/findbugs.xml 2007-11-07 07:16:36 UTC (rev 959) @@ -302,8 +302,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingFunctionSemantics" speed="fast" - reports="CFS_CONFUSING_FUNCTION_SEMANTICS" - hidden="true" /> + reports="CFS_CONFUSING_FUNCTION_SEMANTICS" /> <!-- BugPattern --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-07 07:08:43
|
Revision: 958 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=958&view=rev Author: dbrosius Date: 2007-11-06 23:08:48 -0800 (Tue, 06 Nov 2007) Log Message: ----------- create branch 3.4.1 Added Paths: ----------- tags/v3_4_1/ Copied: tags/v3_4_1 (from rev 957, trunk/fb-contrib) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-07 07:05:22
|
Revision: 957 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=957&view=rev Author: dbrosius Date: 2007-11-06 23:05:22 -0800 (Tue, 06 Nov 2007) Log Message: ----------- get ready for 3.4.1 Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2007-11-07 07:02:42 UTC (rev 956) +++ trunk/fb-contrib/build.xml 2007-11-07 07:05:22 UTC (rev 957) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="3.5.0"/> + <property name="fb-contrib.version" value="3.4.1"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2007-11-07 07:02:42 UTC (rev 956) +++ trunk/fb-contrib/etc/findbugs.xml 2007-11-07 07:05:22 UTC (rev 957) @@ -302,7 +302,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingFunctionSemantics" speed="fast" - reports="CFS_CONFUSING_FUNCTION_SEMANTICS" /> + reports="CFS_CONFUSING_FUNCTION_SEMANTICS" + hidden="true" /> <!-- BugPattern --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-07 07:02:37
|
Revision: 956 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=956&view=rev Author: dbrosius Date: 2007-11-06 23:02:42 -0800 (Tue, 06 Nov 2007) Log Message: ----------- get rid of java5 dependencies Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-07 07:01:26 UTC (rev 955) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-07 07:02:42 UTC (rev 956) @@ -163,7 +163,7 @@ } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { int reg = RegisterUtils.getAStoreReg(this, seen); - possibleParmRegs.remove(Integer.valueOf(reg)); + possibleParmRegs.remove(Integer14.valueOf(reg)); } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { String calledSig = getSigConstantOperand(); String calledRet = Type.getReturnType(calledSig).getSignature(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2007-11-07 07:01:26 UTC (rev 955) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2007-11-07 07:02:42 UTC (rev 956) @@ -39,6 +39,7 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.SignatureUtils; import edu.umd.cs.findbugs.BugInstance; @@ -127,7 +128,7 @@ try { stack.mergeJumps(this); int pc = getPC(); - CodeException ex = catchHandlerPCs.get(Integer.valueOf(pc)); + CodeException ex = catchHandlerPCs.get(Integer14.valueOf(pc)); if (ex != null) { int endPC; if ((seen == GOTO) || (seen == GOTO_W)) @@ -235,7 +236,7 @@ LinkedHashMap<Integer, CodeException> handlers = new LinkedHashMap<Integer, CodeException>(); for (CodeException ex : filteredEx) { - handlers.put(Integer.valueOf(ex.getEndPC()), ex); + handlers.put(Integer14.valueOf(ex.getEndPC()), ex); } return handlers; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-07 07:01:22
|
Revision: 955 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=955&view=rev Author: dbrosius Date: 2007-11-06 23:01:26 -0800 (Tue, 06 Nov 2007) Log Message: ----------- get rid of java 5 dependencies Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-03 04:27:00 UTC (rev 954) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-11-07 07:01:26 UTC (rev 955) @@ -29,6 +29,7 @@ import org.apache.bcel.classfile.ConstantDouble; import org.apache.bcel.classfile.JavaClass; +import com.mebigfatguy.fbcontrib.utils.Integer14; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; import edu.umd.cs.findbugs.BugInstance; @@ -102,14 +103,14 @@ stack.mergeJumps(this); if (((seen >= IFEQ) && (seen <= GOTO)) || (seen == IFNULL) || (seen == IFNONNULL) || (seen == GOTO_W)) { - Integer branchTarget = Integer.valueOf(getBranchTarget()); + Integer branchTarget = Integer14.valueOf(getBranchTarget()); Set<Integer> branchInsSet = branchTargets.get(branchTarget); if (branchInsSet == null) { branchInsSet = new HashSet<Integer>(); branchTargets.put(branchTarget, branchInsSet); } - branchInsSet.add(Integer.valueOf(getPC())); + branchInsSet.add(Integer14.valueOf(getPC())); } if (seen == IFEQ) { @@ -126,10 +127,10 @@ && ((0x00FF & bytes[lastPCs[0]]) == IFEQ)) { if (getMethod().getSignature().endsWith("Z")) { boolean bug = true; - Set<Integer> branchInsSet = branchTargets.get(Integer.valueOf(lastPCs[1])); + Set<Integer> branchInsSet = branchTargets.get(Integer14.valueOf(lastPCs[1])); if (branchInsSet != null) bug = false; - branchInsSet = branchTargets.get(Integer.valueOf(lastPCs[3])); + branchInsSet = branchTargets.get(Integer14.valueOf(lastPCs[3])); if ((branchInsSet != null) && branchInsSet.size() > 1) bug = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-03 04:27:01
|
Revision: 954 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=954&view=rev Author: dbrosius Date: 2007-11-02 21:27:00 -0700 (Fri, 02 Nov 2007) Log Message: ----------- remove experimental tag on previously released detectors Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2007-11-03 03:57:43 UTC (rev 953) +++ trunk/fb-contrib/etc/findbugs.xml 2007-11-03 04:27:00 UTC (rev 954) @@ -333,8 +333,8 @@ <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING_VALUEOF" category="PERFORMANCE" /> <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_PARSE" category="PERFORMANCE" /> <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_VALUEOF" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_UNBOX" category="PERFORMANCE" experimental="true" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_CAST" category="PERFORMANCE" experimental="true" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_UNBOX" category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_CAST" 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" /> @@ -384,21 +384,21 @@ <BugPattern abbrev="SPP" type="SPP_USE_BIGDECIMAL_STRING_CTOR" category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_STRINGBUFFER_WITH_EMPTY_STRING" category="PERFORMANCE" /> <BugPattern abbrev="SPP" type="SPP_EQUALS_ON_ENUM" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_INVALID_BOOLEAN_NULL_CHECK" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="SPP" type="SPP_USE_CHARAT" category="PERFORMANCE" experimental="true" /> - <BugPattern abbrev="SPP" type="SPP_USELESS_TRINARY" category="PERFORMANCE" experimental="true" /> + <BugPattern abbrev="SPP" type="SPP_INVALID_BOOLEAN_NULL_CHECK" category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_USE_CHARAT" category="PERFORMANCE" /> + <BugPattern abbrev="SPP" type="SPP_USELESS_TRINARY" category="PERFORMANCE" /> <BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" /> <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" /> <BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" /> - <BugPattern abbrev="DWI" type="DWI_MODIFYING_WHILE_ITERATING" category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="DWI" type="DWI_MODIFYING_WHILE_ITERATING" category="CORRECTNESS" /> <BugPattern abbrev="USS" type="USS_USE_STRING_SPLIT" category="STYLE" /> - <BugPattern abbrev="SJVU" type="SJVU_SUSPICIOUS_JDK_VERSION_USE" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="UAA" type="UAA_USE_ADD_ALL" category="STYLE" experimental="true" /> - <BugPattern abbrev="MRC" type="MRC_METHOD_RETURNS_CONSTANT" category="STYLE" experimental="true" /> - <BugPattern abbrev="NCS" type="NCS_NEEDLESS_CUSTOM_SERIALIZATION" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="MOM" type="MOM_MISLEADING_OVERLOAD_MODEL" category="STYLE" experimental="true" /> - <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS" category="STYLE" experimental="true" /> - <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_HAS_CHECKED" category="STYLE" experimental="true" /> - <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CHECKED" category="STYLE" experimental="true" /> + <BugPattern abbrev="SJVU" type="SJVU_SUSPICIOUS_JDK_VERSION_USE" category="CORRECTNESS" /> + <BugPattern abbrev="UAA" type="UAA_USE_ADD_ALL" category="STYLE" /> + <BugPattern abbrev="MRC" type="MRC_METHOD_RETURNS_CONSTANT" category="STYLE" /> + <BugPattern abbrev="NCS" type="NCS_NEEDLESS_CUSTOM_SERIALIZATION" category="CORRECTNESS" /> + <BugPattern abbrev="MOM" type="MOM_MISLEADING_OVERLOAD_MODEL" category="STYLE" /> + <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS" category="STYLE" /> + <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_HAS_CHECKED" category="STYLE" /> + <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CHECKED" category="STYLE" /> <BugPattern abbrev="CFS" type="CFS_CONFUSING_FUNCTION_SEMANTICS" category="STYLE" experimental="true" /> </FindbugsPlugin> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-03 03:57:39
|
Revision: 953 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=953&view=rev Author: dbrosius Date: 2007-11-02 20:57:43 -0700 (Fri, 02 Nov 2007) Log Message: ----------- primarily report the return pc, but also include the alter pc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-03 03:27:19 UTC (rev 952) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-03 03:57:43 UTC (rev 953) @@ -124,10 +124,11 @@ stack.resetForMethodEntry(this); super.visitCode(obj); for (ParmUsage pu : possibleParmRegs.values()) { - if (pu.returned && (pu.alteredPC >= 0)) { + if ((pu.returnPC >= 0) && (pu.alteredPC >= 0)) { bugReporter.reportBug(new BugInstance(this, "CFS_CONFUSING_FUNCTION_SEMANTICS", NORMAL_PRIORITY) .addClass(this) .addMethod(this) + .addSourceLine(this, pu.returnPC) .addSourceLine(this, pu.alteredPC)); } } @@ -150,7 +151,7 @@ int reg = item.getRegisterNumber(); ParmUsage pu = possibleParmRegs.get(Integer14.valueOf(reg)); if (pu != null) - pu.setReturned(); + pu.setReturnPC(getPC()); } } else if (seen == PUTFIELD) { if (stack.getStackDepth() > 1) { @@ -185,11 +186,11 @@ static class ParmUsage { - boolean returned = false; + int returnPC = -1; int alteredPC = -1; - public void setReturned() { - returned = true; + public void setReturnPC(int pc) { + returnPC = pc; } public void setAlteredPC(int pc) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2007-11-03 03:27:19 UTC (rev 952) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2007-11-03 03:57:43 UTC (rev 953) @@ -24,6 +24,7 @@ import java.util.Map; import java.util.Set; +import org.apache.bcel.Repository; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; @@ -179,7 +180,7 @@ if (populate) { possibleCommonTypes.addAll(Arrays.asList(infs)); possibleCommonTypes.addAll(Arrays.asList(supers)); - possibleCommonTypes.remove("java/lang/Object"); + possibleCommonTypes.remove(Repository.lookupClass("java/lang/Object")); populate = false; } else { Set<JavaClass> retain = new HashSet<JavaClass>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-03 03:27:18
|
Revision: 952 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=952&view=rev Author: dbrosius Date: 2007-11-02 20:27:19 -0700 (Fri, 02 Nov 2007) Log Message: ----------- DLS fixes Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-03 02:52:55 UTC (rev 951) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-03 03:27:19 UTC (rev 952) @@ -123,10 +123,7 @@ if (possibleParmRegs.size() > 0) { stack.resetForMethodEntry(this); super.visitCode(obj); - for (Map.Entry<Integer, ParmUsage> entry : possibleParmRegs.entrySet()) { - Integer reg = entry.getKey(); - ParmUsage pu = entry.getValue(); - + for (ParmUsage pu : possibleParmRegs.values()) { if (pu.returned && (pu.alteredPC >= 0)) { bugReporter.reportBug(new BugInstance(this, "CFS_CONFUSING_FUNCTION_SEMANTICS", NORMAL_PRIORITY) .addClass(this) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2007-11-03 02:52:55 UTC (rev 951) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2007-11-03 03:27:19 UTC (rev 952) @@ -89,7 +89,7 @@ bugReporter.reportMissingClass(cnfe); } finally { superclassCode = null; - classContext = null; + this.classContext = null; childPoolGen = null; parentPoolGen = null; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2007-11-03 02:52:55 UTC (rev 951) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2007-11-03 03:27:19 UTC (rev 952) @@ -37,7 +37,7 @@ Method[] methods = cls.getMethods(); for (Method m : methods) { String methodName = m.getName(); - boolean report = false; + boolean report; MethodType newType; if (m.isStatic()) { report = declMethods.get(methodName) == MethodType.INSTANCE; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2007-11-03 02:52:55 UTC (rev 951) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2007-11-03 03:27:19 UTC (rev 952) @@ -125,7 +125,7 @@ @Override public void sawOpcode(int seen) { - String clsName = null; + String clsName; try { if ((seen == INVOKEVIRTUAL) //Interfaces are more difficult, ignore for now Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2007-11-03 02:52:55 UTC (rev 951) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2007-11-03 03:27:19 UTC (rev 952) @@ -103,7 +103,7 @@ } JavaClass cls = findCommonType(returnTypes.keySet()); - BugInstance bug = null; + BugInstance bug; if ((cls != null) && !isInherited) { bug = new BugInstance(this, "URV_CHANGE_RETURN_TYPE", priority) .addClass(this) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java 2007-11-03 02:52:55 UTC (rev 951) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java 2007-11-03 03:27:19 UTC (rev 952) @@ -119,7 +119,7 @@ @Override public void sawOpcode(int seen) { Comparable regOrField = null; - Comparable uValue = null; + Comparable uValue; boolean sawAlias = false; boolean sawLoad = false; @@ -243,7 +243,6 @@ if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); if (item.getRegisterNumber() == 0) { - uValue = userValues.get(getNameConstantOperand()); sawLoad = true; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-03 02:52:52
|
Revision: 951 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=951&view=rev Author: dbrosius Date: 2007-11-02 19:52:55 -0700 (Fri, 02 Nov 2007) Log Message: ----------- if a store to a parameter occurs, remove that parameter from considerations Modified Paths: -------------- trunk/fb-contrib/samples/CFS_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java Modified: trunk/fb-contrib/samples/CFS_Sample.java =================================================================== --- trunk/fb-contrib/samples/CFS_Sample.java 2007-11-02 23:16:33 UTC (rev 950) +++ trunk/fb-contrib/samples/CFS_Sample.java 2007-11-03 02:52:55 UTC (rev 951) @@ -7,4 +7,11 @@ d.setHours(0); return d; } + + public Date getNextDateFP(Date d) + { + d = (Date)d.clone(); + d.setHours(0); + return d; + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-02 23:16:33 UTC (rev 950) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-03 02:52:55 UTC (rev 951) @@ -163,6 +163,9 @@ if (pu != null) pu.setAlteredPC(getPC()); } + } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { + int reg = RegisterUtils.getAStoreReg(this, seen); + possibleParmRegs.remove(Integer.valueOf(reg)); } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { String calledSig = getSigConstantOperand(); String calledRet = Type.getReturnType(calledSig).getSignature(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-02 23:16:48
|
Revision: 950 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=950&view=rev Author: dbrosius Date: 2007-11-02 16:16:33 -0700 (Fri, 02 Nov 2007) Log Message: ----------- clear possibleParmRegs on method entry Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-02 05:00:22 UTC (rev 949) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-02 23:16:33 UTC (rev 950) @@ -60,7 +60,7 @@ knownImmutables.add("Ljava/lang/Class;"); }; - private BugReporter bugReporter; + private final BugReporter bugReporter; private Map<Integer, ParmUsage> possibleParmRegs; private OpcodeStack stack; @@ -96,6 +96,7 @@ @Override public void visitCode(Code obj) { try { + possibleParmRegs.clear(); Method m = getMethod(); String methodSignature = m.getSignature(); String retSignature = Type.getReturnType(methodSignature).getSignature(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-02 05:00:20
|
Revision: 949 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=949&view=rev Author: dbrosius Date: 2007-11-01 22:00:22 -0700 (Thu, 01 Nov 2007) Log Message: ----------- initial checkin CFS detector, barely working Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml Added Paths: ----------- trunk/fb-contrib/samples/CFS_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2007-11-02 03:30:37 UTC (rev 948) +++ trunk/fb-contrib/etc/findbugs.xml 2007-11-02 05:00:22 UTC (rev 949) @@ -300,6 +300,10 @@ speed="moderate" reports="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS,EXS_EXCEPTION_SOFTENING_HAS_CHECKED,EXS_EXCEPTION_SOFTENING_NO_CHECKED" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingFunctionSemantics" + speed="fast" + reports="CFS_CONFUSING_FUNCTION_SEMANTICS" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -396,4 +400,5 @@ <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS" category="STYLE" experimental="true" /> <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_HAS_CHECKED" category="STYLE" experimental="true" /> <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CHECKED" category="STYLE" experimental="true" /> + <BugPattern abbrev="CFS" type="CFS_CONFUSING_FUNCTION_SEMANTICS" category="STYLE" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2007-11-02 03:30:37 UTC (rev 948) +++ trunk/fb-contrib/etc/messages.xml 2007-11-02 05:00:22 UTC (rev 949) @@ -584,7 +584,7 @@ <Details> <![CDATA[ <p>looks for if/else blocks where a series of them use instanceof on the same - variable to determine what do to. If these classes are related by inheritance, + variable to determine what to do. If these classes are related by inheritance, this often is better handled through calling a single overridden method.</p> <p>It is a moderately fast detector</p> ]]> @@ -816,6 +816,21 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingFunctionSemantics"> + <Details> + <![CDATA[ + <p>looks for methods that return a parameter after modifying that parameter. + Doing this will confuse the user of this method, as it will be assumed that the + passed in argument is different than the output, or at least won't be changed. + If the purpose of this method is just to modify the parameter, this method should + probably be changed to have a void return type. If you must return a variable, perhaps + a clone of the parameter should be returned. + </p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -2055,6 +2070,21 @@ </Details> </BugPattern> + <BugPattern type="CFS_CONFUSING_FUNCTION_SEMANTICS"> + <ShortDescription>method returns modified parameter</ShortDescription> + <LongDescription>method {1} returns modified parameter</LongDescription> + <Details> + <![CDATA[ + <p>This method appears to modify a parameter, and then return this parameter as the + methods return value. This will be confusing to callers of this method, as it won't be + apparent that the 'original' passed in parameter will be changed as well. If the purpose + of this method is to change the parameter, it would be more clear to change the method to + a have a void return value. If a return type is required due to interface or superclass contract, + perhaps a clone of the parameter should be made.</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2124,4 +2154,5 @@ <BugCode abbrev="NCS">Needless Custom Serialization</BugCode> <BugCode abbrev="MOM">Misleading Overload Model</BugCode> <BugCode abbrev="EXS">Exception Softening</BugCode> + <BugCode abbrev="CFS">Confusing Function Semantics</BugCode> </MessageCollection> \ No newline at end of file Added: trunk/fb-contrib/samples/CFS_Sample.java =================================================================== --- trunk/fb-contrib/samples/CFS_Sample.java (rev 0) +++ trunk/fb-contrib/samples/CFS_Sample.java 2007-11-02 05:00:22 UTC (rev 949) @@ -0,0 +1,10 @@ +import java.util.Date; + +public class CFS_Sample +{ + public Date getNextDate(Date d) + { + d.setHours(0); + return d; + } +} Property changes on: trunk/fb-contrib/samples/CFS_Sample.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2007-11-02 05:00:22 UTC (rev 949) @@ -0,0 +1,199 @@ +/* + * fb-contrib - Auxilliary detectors for Java programs + * Copyright (C) 2005-2007 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; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.bcel.Repository; +import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.JavaClass; +import org.apache.bcel.classfile.Method; +import org.apache.bcel.generic.Type; + +import com.mebigfatguy.fbcontrib.utils.Integer14; +import com.mebigfatguy.fbcontrib.utils.RegisterUtils; + +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.ba.ClassContext; + +/** looks for methods that return a parameter after making what looks like + * modifications to that parameter. This leads to confusing on the user of this + * method as it isn't obvious that the 'original' object is modified. If the + * point of this method is to modify the parameter, it is probably better just + * to have the method be a void method, to avoid confusion. + */ +public class ConfusingFunctionSemantics extends BytecodeScanningDetector +{ + private static final Set<String> knownImmutables = new HashSet<String>(); + static { + knownImmutables.add("Ljava/lang/String;"); + knownImmutables.add("Ljava/lang/Byte;"); + knownImmutables.add("Ljava/lang/Character;"); + knownImmutables.add("Ljava/lang/Short;"); + knownImmutables.add("Ljava/lang/Integer;"); + knownImmutables.add("Ljava/lang/Long;"); + knownImmutables.add("Ljava/lang/Float;"); + knownImmutables.add("Ljava/lang/Double;"); + knownImmutables.add("Ljava/lang/Boolean;"); + knownImmutables.add("Ljava/lang/Class;"); + }; + + private BugReporter bugReporter; + private Map<Integer, ParmUsage> possibleParmRegs; + private OpcodeStack stack; + + /** + * constructs a CFS detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ + public ConfusingFunctionSemantics(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + /** implements the visitor to initialize/destroy the possible parameter registers and opcode stack + * + * @param classContext the context object of the currently parsed class + */ + @Override + public void visitClassContext(ClassContext classContext) { + try { + stack = new OpcodeStack(); + possibleParmRegs = new HashMap<Integer, ParmUsage>(); + super.visitClassContext(classContext); + } finally { + stack = null; + possibleParmRegs = null; + } + } + + /** implements the visitor to look for any non-immutable typed parameters are assignable + * to the return type. If found, the method is parsed. + * + * @param obj the context object of the currently parsed code block + */ + @Override + public void visitCode(Code obj) { + try { + Method m = getMethod(); + String methodSignature = m.getSignature(); + String retSignature = Type.getReturnType(methodSignature).getSignature(); + JavaClass returnClass = null; + int[] parmRegs = null; + + if ((retSignature.charAt(0) == 'L') && !knownImmutables.contains(retSignature)) { + Type[] parmTypes = Type.getArgumentTypes(methodSignature); + for (int p = 0; p < parmTypes.length; p++) { + String parmSignature = parmTypes[p].getSignature(); + if ((parmSignature.charAt(0) == 'L') && !knownImmutables.contains(parmSignature)) { + if (returnClass == null) { + returnClass = Repository.lookupClass(retSignature.substring(1, retSignature.length() - 1)); + parmRegs = RegisterUtils.getParameterRegisters(m); + } + + JavaClass parmClass = Repository.lookupClass(parmSignature.substring(1, parmSignature.length() - 1)); + if (parmClass.instanceOf(returnClass)) { + possibleParmRegs.put(Integer14.valueOf(parmRegs[p]), new ParmUsage()); + } + } + } + + if (possibleParmRegs.size() > 0) { + stack.resetForMethodEntry(this); + super.visitCode(obj); + for (Map.Entry<Integer, ParmUsage> entry : possibleParmRegs.entrySet()) { + Integer reg = entry.getKey(); + ParmUsage pu = entry.getValue(); + + if (pu.returned && (pu.alteredPC >= 0)) { + bugReporter.reportBug(new BugInstance(this, "CFS_CONFUSING_FUNCTION_SEMANTICS", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this, pu.alteredPC)); + } + } + } + } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); + } + } + + @Override + public void sawOpcode(int seen) { + if (possibleParmRegs.size() == 0) + return; + + try { + if (seen == ARETURN) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item item = stack.getStackItem(0); + int reg = item.getRegisterNumber(); + ParmUsage pu = possibleParmRegs.get(Integer14.valueOf(reg)); + if (pu != null) + pu.setReturned(); + } + } else if (seen == PUTFIELD) { + if (stack.getStackDepth() > 1) { + OpcodeStack.Item item = stack.getStackItem(1); + int reg = item.getRegisterNumber(); + ParmUsage pu = possibleParmRegs.get(Integer14.valueOf(reg)); + if (pu != null) + pu.setAlteredPC(getPC()); + } + } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { + String calledSig = getSigConstantOperand(); + String calledRet = Type.getReturnType(calledSig).getSignature(); + if ("V".equals(calledRet)) { + int calledObjOffset = Type.getArgumentTypes(calledSig).length; + if (stack.getStackDepth() >= calledObjOffset) { + OpcodeStack.Item item = stack.getStackItem(calledObjOffset); + int reg = item.getRegisterNumber(); + ParmUsage pu = possibleParmRegs.get(Integer14.valueOf(reg)); + if (pu != null) + pu.setAlteredPC(getPC()); + } + } + } + + } finally { + stack.sawOpcode(this, seen); + } + } + + static class ParmUsage + { + boolean returned = false; + int alteredPC = -1; + + public void setReturned() { + returned = true; + } + + public void setAlteredPC(int pc) { + if (alteredPC < 0) + alteredPC = pc; + } + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-02 03:30:33
|
Revision: 948 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=948&view=rev Author: dbrosius Date: 2007-11-01 20:30:37 -0700 (Thu, 01 Nov 2007) Log Message: ----------- start work towards 3.6 Modified Paths: -------------- trunk/fb-contrib/build.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2007-11-01 04:04:52 UTC (rev 947) +++ trunk/fb-contrib/build.xml 2007-11-02 03:30:37 UTC (rev 948) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="3.4.0"/> + <property name="fb-contrib.version" value="3.5.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-01 04:04:50
|
Revision: 947 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=947&view=rev Author: dbrosius Date: 2007-10-31 21:04:52 -0700 (Wed, 31 Oct 2007) Log Message: ----------- update svn to 3.4.0 Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2007-11-01 03:50:44 UTC (rev 946) +++ trunk/fb-contrib/htdocs/index.html 2007-11-01 04:04:52 UTC (rev 947) @@ -48,9 +48,9 @@ <a href="bugdescriptions.html">Bug Descriptions</a> <hr/> - <img id="svn_image" src="flip2.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> - Detectors add in svn<br/> - <div id="svn" style="display:block;"> + <img id="v3_4_0_image" src="flip2.gif" onClick="toggleBlock('v3_4_0', 'v3_4_0_image');" align="top"/> + Detectors add in v3.4.0<br/> + <div id="v3_4_0" style="display:block;"> <ul> <li><b>[SJVU] Suspicious JDK Version Use</b><br/> Looks for calls to classes and methods that do not exist in the JDK for which this class is This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-01 03:50:40
|
Revision: 946 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=946&view=rev Author: dbrosius Date: 2007-10-31 20:50:44 -0700 (Wed, 31 Oct 2007) Log Message: ----------- branch v3.4.0 Added Paths: ----------- tags/v3_4_0/ Copied: tags/v3_4_0 (from rev 945, trunk/fb-contrib) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-01 03:48:56
|
Revision: 945 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=945&view=rev Author: dbrosius Date: 2007-10-31 20:49:00 -0700 (Wed, 31 Oct 2007) Log Message: ----------- get ready for 3.4.0 Modified Paths: -------------- trunk/fb-contrib/build.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2007-11-01 03:45:45 UTC (rev 944) +++ trunk/fb-contrib/build.xml 2007-11-01 03:49:00 UTC (rev 945) @@ -177,6 +177,6 @@ </copy> </target> - <target name="release" depends="build, check14, javadoc" description="prepares everything for a release"/> + <target name="release" depends="build, check14, srczip, html, javadoc" description="prepares everything for a release"/> </project> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-01 03:45:40
|
Revision: 944 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=944&view=rev Author: dbrosius Date: 2007-10-31 20:45:45 -0700 (Wed, 31 Oct 2007) Log Message: ----------- get ready for 3.4.0 Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2007-11-01 03:43:55 UTC (rev 943) +++ trunk/fb-contrib/etc/findbugs.xml 2007-11-01 03:45:45 UTC (rev 944) @@ -277,7 +277,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousJDKVersionUse" speed="slow" - reports="SJVU_SUSPICIOUS_JDK_VERSION_USE" /> + reports="SJVU_SUSPICIOUS_JDK_VERSION_USE" + disabled="true" /> <Detector class="com.mebigfatguy.fbcontrib.detect.UseAddAll" speed="fast" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-11-01 03:43:54
|
Revision: 943 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=943&view=rev Author: dbrosius Date: 2007-10-31 20:43:55 -0700 (Wed, 31 Oct 2007) Log Message: ----------- get ready for 3.4.0 Modified Paths: -------------- trunk/fb-contrib/build.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2007-10-31 05:16:52 UTC (rev 942) +++ trunk/fb-contrib/build.xml 2007-11-01 03:43:55 UTC (rev 943) @@ -20,7 +20,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="3.3.0"/> + <property name="fb-contrib.version" value="3.4.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2007-10-31 05:17:02
|
Revision: 942 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=942&view=rev Author: dbrosius Date: 2007-10-30 22:16:52 -0700 (Tue, 30 Oct 2007) Log Message: ----------- don't report useless trinaries when the ifeq is on something other than a boolean Modified Paths: -------------- trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2007-10-18 05:38:45 UTC (rev 941) +++ trunk/fb-contrib/samples/SPP_Sample.java 2007-10-31 05:16:52 UTC (rev 942) @@ -91,4 +91,9 @@ return a && b; } + + public boolean testFPTrinaryOnInt(String s) + { + return (s.length() != 0); + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-10-18 05:38:45 UTC (rev 941) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java 2007-10-31 05:16:52 UTC (rev 942) @@ -47,6 +47,7 @@ private int lastPCs[]; private int lastOpcode; private int lastReg; + private boolean lastIfEqWasBoolean; /** branch targets, to a set of branch instructions */ private Map<Integer, Set<Integer>> branchTargets; @@ -82,6 +83,7 @@ stack.resetForMethodEntry(this); lastOpcode = -1; lastReg = -1; + lastIfEqWasBoolean = false; Arrays.fill(lastPCs, -1); branchTargets.clear(); super.visitCode(obj); @@ -110,8 +112,12 @@ branchInsSet.add(Integer.valueOf(getPC())); } - - if (seen == IRETURN) { + if (seen == IFEQ) { + if (stack.getStackDepth() > 0) { + OpcodeStack.Item itm = stack.getStackItem(0); + lastIfEqWasBoolean = "Z".equals(itm.getElementSignature()); + } + } else if ((seen == IRETURN) && lastIfEqWasBoolean) { byte[] bytes = getCode().getCode(); if ((lastPCs[0] != -1) && ((0x00FF & bytes[lastPCs[3]]) == ICONST_0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |