fb-contrib-commit Mailing List for fb-contrib (Page 65)
Brought to you by:
dbrosius
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(56) |
Oct
(60) |
Nov
(58) |
Dec
(89) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(66) |
Feb
(55) |
Mar
(85) |
Apr
(115) |
May
(35) |
Jun
(28) |
Jul
(3) |
Aug
(48) |
Sep
(37) |
Oct
(22) |
Nov
(14) |
Dec
(66) |
2007 |
Jan
(45) |
Feb
(63) |
Mar
(10) |
Apr
(1) |
May
(1) |
Jun
(12) |
Jul
|
Aug
|
Sep
(25) |
Oct
(21) |
Nov
(39) |
Dec
|
2008 |
Jan
(7) |
Feb
|
Mar
(26) |
Apr
(5) |
May
(2) |
Jun
(32) |
Jul
(9) |
Aug
(10) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
|
2009 |
Jan
(10) |
Feb
(31) |
Mar
(32) |
Apr
(35) |
May
(25) |
Jun
|
Jul
(31) |
Aug
(10) |
Sep
(95) |
Oct
(35) |
Nov
(10) |
Dec
(34) |
2010 |
Jan
(90) |
Feb
(4) |
Mar
(7) |
Apr
(20) |
May
(20) |
Jun
(13) |
Jul
(7) |
Aug
(18) |
Sep
(25) |
Oct
(4) |
Nov
(16) |
Dec
(2) |
2011 |
Jan
(1) |
Feb
|
Mar
(11) |
Apr
(3) |
May
(2) |
Jun
(26) |
Jul
(10) |
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(14) |
Nov
(3) |
Dec
(4) |
2013 |
Jan
(3) |
Feb
(2) |
Mar
(1) |
Apr
(4) |
May
|
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
(4) |
Nov
(3) |
Dec
(3) |
2014 |
Jan
(4) |
Feb
(2) |
Mar
(4) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(3) |
Dec
(3) |
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
(2) |
Nov
(7) |
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
(5) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(3) |
2018 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(5) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Dave B. <dbr...@us...> - 2006-01-23 07:53:14
|
Update of /cvsroot/fb-contrib/fb-contrib/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9694/lib Modified Files: findbugs.jar Log Message: initial checkin new AWCBR detector - semi working (requires findbugs.jar 0.95) Index: findbugs.jar =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/lib/findbugs.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 Binary files /tmp/cvs0tBAya and /tmp/cvsVWljD5 differ |
From: Dave B. <dbr...@us...> - 2006-01-23 07:53:14
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9694/samples Added Files: AWCBR_Sample.java Log Message: initial checkin new AWCBR detector - semi working (requires findbugs.jar 0.95) --- NEW FILE: AWCBR_Sample.java --- public class AWCBR_Sample { public void m(int[] v) { v[0]++; } public int testuninitedalloc(int i) { int[] data = new int[1]; data[0] = i; m(data); i = data[0]; return i; } public int testinitedalloc(int i) { int[] data = new int[] { i }; m(data); i = data[0]; return i; } } |
From: Dave B. <dbr...@us...> - 2006-01-21 07:01:00
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13081/etc Modified Files: findbugs.xml messages.xml Log Message: adjust timings for detectors Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- messages.xml 21 Jan 2006 06:16:53 -0000 1.47 +++ messages.xml 21 Jan 2006 07:00:52 -0000 1.48 @@ -47,7 +47,7 @@ <![CDATA[ <p> Calculates the McCabe Cyclomatic Complexity measure and reports methods that have an excessive value. This report value can be set with system property 'fb-contrib.cc.limit'.</p> - <p>It is a fast detector</p> + <p>It is a slow detector</p> ]]> </Details> </Detector> @@ -58,7 +58,7 @@ <p> Looks for parameters that are defined by classes, but only use methods defined by an implemented interface or super class. Relying on concrete classes in public signatures causes cohesion, and makes low impact changes more difficult.</p> - <p>It is a slow detector</p> + <p>It is a fast detector</p> ]]> </Details> </Detector> @@ -83,7 +83,7 @@ determine type. A better design usually can be had by creating a seperate class, which defines the different types required, and add an instance of that class to the collection, or array.</p> - <p>It is a fast detector</p> + <p>It is a moderately fast detector</p> ]]> </Details> </Detector> @@ -107,7 +107,7 @@ methods. When this is the case, it is often better to implement this method in that other class, by refactoring the class to accept parameters it needs from the source class. The reporting percentage can be set with system property 'fb-contrib.ce.percent'.</p> - <p>It is a fast detector</p> + <p>It is a moderately fast detector</p> ]]> </Details> </Detector> @@ -118,7 +118,7 @@ <p> Looks for methods that compare strings against literal strings, where the literal string is passed as the parameter. If the .equals or .compareTo is called on the literal itself, passing the variable as the parameter, you avoid the possibility of a NullPointerException.</p> - <p>It is a fast detector</p> + <p>It is a moderately fast detector</p> ]]> </Details> </Detector> @@ -402,7 +402,7 @@ XXX.class, and doing so protects the integrity of this code from such transformations as obfuscation. Use of Class.forName should only be used when the class in question isn't already statically bound to this context.</p> - <p>It is a moderately fast Detector</p> + <p>It is a fast Detector</p> ]]> </Details> </Detector> Index: findbugs.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/findbugs.xml,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- findbugs.xml 21 Jan 2006 06:16:53 -0000 1.55 +++ findbugs.xml 21 Jan 2006 07:00:52 -0000 1.56 @@ -22,11 +22,11 @@ reports="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CyclomaticComplexity" - speed="fast" + speed="slow" reports="CC_CYCLOMATIC_COMPLEXITY" /> <Detector class="com.mebigfatguy.fbcontrib.detect.OverlyConcreteParameter" - speed="slow" + speed="fast" reports="OCP_OVERLY_CONCRETE_PARAMETER" /> <Detector class="com.mebigfatguy.fbcontrib.detect.ListIndexedIterating" @@ -34,7 +34,7 @@ reports="LII_LIST_INDEXED_ITERATING" /> <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" - speed="fast" + speed="moderate" reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" @@ -42,12 +42,12 @@ reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" - speed="fast" + speed="moderate" reports="CE_CLASS_ENVY" disabled="true" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" - speed="fast" + speed="moderate" reports="LSC_LITERAL_STRING_COMPARISON" /> <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" @@ -135,7 +135,7 @@ reports="CLI_CONSTANT_LIST_INDEX" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" - speed="moderate" + speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> <!-- BugPattern --> |
From: Dave B. <dbr...@us...> - 2006-01-21 06:17:02
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2199/etc Modified Files: findbugs.xml messages.xml Log Message: SCR is only moderately fast Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- messages.xml 20 Jan 2006 06:58:07 -0000 1.46 +++ messages.xml 21 Jan 2006 06:16:53 -0000 1.47 @@ -402,7 +402,7 @@ XXX.class, and doing so protects the integrity of this code from such transformations as obfuscation. Use of Class.forName should only be used when the class in question isn't already statically bound to this context.</p> - <p>It is a fast Detector</p> + <p>It is a moderately fast Detector</p> ]]> </Details> </Detector> @@ -798,13 +798,6 @@ ]]> </Details> </BugPattern> - -Looks for methods that use Class.forName("XXX") to load a class object - for a class that is already referenced by this class. It is simpler to just use - XXX.class, and doing so protects the integrity of this code from such transformations - as obfuscation. Use of Class.forName should only be used when the class in question - isn't already statically bound to this context. - <!-- BugCode --> Index: findbugs.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/findbugs.xml,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- findbugs.xml 20 Jan 2006 06:58:07 -0000 1.54 +++ findbugs.xml 21 Jan 2006 06:16:53 -0000 1.55 @@ -135,7 +135,7 @@ reports="CLI_CONSTANT_LIST_INDEX" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" - speed="fast" + speed="moderate" reports="SCR_SLOPPY_CLASS_REFLECTION" /> <!-- BugPattern --> |
From: Dave B. <dbr...@us...> - 2006-01-20 07:01:54
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12001/htdocs Modified Files: index.html Log Message: doc SCR Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -r1.54 -r1.55 --- index.html 17 Jan 2006 04:05:55 -0000 1.54 +++ index.html 20 Jan 2006 07:01:46 -0000 1.55 @@ -58,6 +58,12 @@ this is a typo where a loop variable is intended to be used. If however, specific list indices mean different specific things, then perhaps replacing the list with a first-class object with meaningful accessors would make the code less brittle.</li> + <li><b>Sloppy Class Reflection</b><br/> + Looks for methods that use Class.forName("XXX") to load a class object + for a class that is already referenced by this class. It is simpler to just use + XXX.class, and doing so protects the integrity of this code from such transformations + as obfuscation. Use of Class.forName should only be used when the class in question + isn't already statically bound to this context.</li> </ul> </div> |
From: Dave B. <dbr...@us...> - 2006-01-20 06:58:21
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10975/samples Added Files: SCR_Sample.java Log Message: new detector SCR, initial checkin --- NEW FILE: SCR_Sample.java --- class A {} class B {} public class SCR_Sample { A a; public String testForNameOfThis() { try { Class c = Class.forName("SCR_Sample"); return c.getName(); } catch (ClassNotFoundException cnfe) { return null; } } public String testForNameOfMember() { try { Class c = Class.forName("A"); return c.getName(); } catch (ClassNotFoundException cnfe) { return null; } } public String testForNameOfLocal(B b) { try { Class c = Class.forName("B"); return c.getName(); } catch (ClassNotFoundException cnfe) { return null; } } public String testForNameOfUnknown() { try { Class c = Class.forName("C"); return c.getName(); } catch (ClassNotFoundException cnfe) { return null; } } public String testGetClass() { Class c = this.getClass(); return c.getName(); } public String testDotClass() { return SCR_Sample.class.getName(); } } |
From: Dave B. <dbr...@us...> - 2006-01-20 06:58:21
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10975/etc Modified Files: findbugs.xml messages.xml Log Message: new detector SCR, initial checkin Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- messages.xml 16 Jan 2006 05:05:03 -0000 1.45 +++ messages.xml 20 Jan 2006 06:58:07 -0000 1.46 @@ -394,6 +394,19 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection"> + <Details> + <![CDATA[ + <p>Looks for methods that use Class.forName("XXX") to load a class object + for a class that is already referenced by this class. It is simpler to just use + XXX.class, and doing so protects the integrity of this code from such transformations + as obfuscation. Use of Class.forName should only be used when the class in question + isn't already statically bound to this context.</p> + <p>It is a fast Detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -771,9 +784,28 @@ a first-class object with meaningful accessors would make the code less brittle.</p> ]]> </Details> - </BugPattern> + <BugPattern type="SCR_SLOPPY_CLASS_REFLECTION"> + <ShortDescription>method accesses statically bound class with Class.forName</ShortDescription> + <LongDescription>method {1} accesses statically bound class with Class.forName</LongDescription> + <Details> + <![CDATA[ + <p>This method accesses the class object of a class that is already statically bound + in this context, with Class.forName. Using Class.forName makes reflection more fragile + in regards to code transformations such as obfuscation, and is unneeded here, since + the class in question is already 'linked' to this class.</p> + ]]> + </Details> + </BugPattern> + +Looks for methods that use Class.forName("XXX") to load a class object + for a class that is already referenced by this class. It is simpler to just use + XXX.class, and doing so protects the integrity of this code from such transformations + as obfuscation. Use of Class.forName should only be used when the class in question + isn't already statically bound to this context. + + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -806,4 +838,5 @@ <BugCode abbrev="CBX">Custom Built XML</BugCode> <BugCode abbrev="BSB">Bloated Synchronized Block</BugCode> <BugCode abbrev="CLI">Constant List Index</BugCode> + <BugCode abbrev="SCR">Sloppy Class Reflection</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.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- findbugs.xml 16 Jan 2006 05:05:03 -0000 1.53 +++ findbugs.xml 20 Jan 2006 06:58:07 -0000 1.54 @@ -134,6 +134,10 @@ speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" + speed="fast" + reports="SCR_SLOPPY_CLASS_REFLECTION" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -166,4 +170,5 @@ <BugPattern abbrev="CBX" type="CBX_CUSTOM_BUILT_XML" category="STYLE" /> <BugPattern abbrev="BSB" type="BSB_BLOATED_SYNCHRONIZED_BLOCK" category="PERFORMANCE" experimental="true" /> <BugPattern abbrev="CLI" type="CLI_CONSTANT_LIST_INDEX" category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="SCR" type="SCR_SLOPPY_CLASS_REFLECTION" category="STYLE" experimental="true" /> </FindbugsPlugin> \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2006-01-20 06:58:21
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10975/src/com/mebigfatguy/fbcontrib/detect Added Files: SloppyClassReflection.java Log Message: new detector SCR, initial checkin --- NEW FILE: SloppyClassReflection.java --- /* * fb-contrib - Auxilliary detectors for Java programs * Copyright (C) 2005-2006 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package com.mebigfatguy.fbcontrib.detect; import java.util.HashSet; import java.util.Set; import org.apache.bcel.classfile.Constant; import org.apache.bcel.classfile.ConstantString; import org.apache.bcel.classfile.ConstantUtf8; import org.apache.bcel.classfile.Field; import org.apache.bcel.classfile.LocalVariable; import org.apache.bcel.classfile.LocalVariableTable; import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; public class SloppyClassReflection extends BytecodeScanningDetector implements StatelessDetector { private static final int COLLECT = -1; private static final int SEEN_NOTHING = 0; private static final int SEEN_LDC = 1; private BugReporter bugReporter; private Set<String> refClasses; private int state; private String clsName; /** * constructs a SCR detector given the reporter to report bugs on * @param bugReporter the sync of bug reports */ public SloppyClassReflection(BugReporter bugReporter) { this.bugReporter = bugReporter; } /** * clone this detector so that it can be a StatelessDetector * * @return a clone of this object */ public Object clone() throws CloneNotSupportedException { return super.clone(); } /** * overrides the visitor to collect all class references * * @param classContext the class context of the currently visited class */ @Override public void visitClassContext(ClassContext classContext) { refClasses = new HashSet<String>(); refClasses.add(classContext.getJavaClass().getClassName()); state = COLLECT; super.visitClassContext(classContext); state = SEEN_NOTHING; super.visitClassContext(classContext); refClasses = null; } /** * overrides the visitor reset the opcode stack * * @param obj the method object of the currently parsed method */ @Override public void visitMethod(Method obj) { if (state == COLLECT) { Type[] argTypes = obj.getArgumentTypes(); for (Type t : argTypes) addType(t); Type resultType = obj.getReturnType(); addType(resultType); LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { for (int l = 0; l < lvt.getLength(); l++) { LocalVariable lv = lvt.getLocalVariable(l); if (lv != null) { Type t = Type.getType(lv.getSignature()); addType(t); } } } } else state = SEEN_NOTHING; super.visitMethod(obj); } public void visitField(Field obj) { if (state == COLLECT) { Type t = obj.getType(); addType(t); } } /** * overrides the visitor to find class loading that is non obfuscation proof * * @param seen the opcode that is being visited */ @Override public void sawOpcode(int seen) { switch (state) { case COLLECT: if ((seen == INVOKESTATIC) && (seen == INVOKEVIRTUAL) && (seen == INVOKEINTERFACE) && (seen == INVOKESPECIAL)) { refClasses.add(getClassConstantOperand()); String signature = getSigConstantOperand(); Type[] argTypes = Type.getArgumentTypes(signature); for (Type t : argTypes) addType(t); Type resultType = Type.getReturnType(signature); addType(resultType); } break; case SEEN_NOTHING: if (seen == LDC) { Constant c = getConstantRefOperand(); if (c instanceof ConstantString) { clsName = ((ConstantString) c).getBytes(getConstantPool()); state = SEEN_LDC; } } break; case SEEN_LDC: if ((seen == INVOKESTATIC) && ("forName".equals(getNameConstantOperand())) && ("java/lang/Class".equals(getClassConstantOperand()))) { if (refClasses.contains(clsName)) { bugReporter.reportBug(new BugInstance(this, "SCR_SLOPPY_CLASS_REFLECTION", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); } } break; } } /** * add the type string represented by the type to the refClasses set if it is a reference * * @param t the type to add */ private void addType(Type t) { String signature = t.getSignature(); if (signature.charAt(0) == 'L') refClasses.add(signature.substring(1, signature.length() - 1)); } } |
From: Dave B. <dbr...@us...> - 2006-01-20 04:24:20
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3489/src/com/mebigfatguy/fbcontrib/detect Modified Files: CustomBuiltXML.java Log Message: add annotations Index: CustomBuiltXML.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CustomBuiltXML.java 4 Jan 2006 02:40:42 -0000 1.5 +++ CustomBuiltXML.java 20 Jan 2006 04:24:04 -0000 1.6 @@ -56,7 +56,7 @@ private int highReportingThreshold; private int firstPC; - /** + /** * constructs a CBX detector given the reporter to report bugs on * @param bugReporter the sync of bug reports @@ -84,6 +84,7 @@ * * @param obj the code object of the currently parsed method */ + @Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); xmlItemCount = 0; @@ -108,6 +109,7 @@ * * @param seen the opcode that is being visited */ + @Override public void sawOpcode(int seen) { String strCon = null; |
From: Dave B. <dbr...@us...> - 2006-01-18 03:24:02
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv626/src/com/mebigfatguy/fbcontrib/detect Modified Files: ConstantListIndex.java Log Message: a flat out guess is that list/array loads at index 0 are bad when they are close to the top of the loop. The further away, the more likely that they are 'ok'. Index: ConstantListIndex.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ConstantListIndex.java 18 Jan 2006 03:11:38 -0000 1.6 +++ ConstantListIndex.java 18 Jan 2006 03:23:52 -0000 1.7 @@ -32,14 +32,15 @@ import edu.umd.cs.findbugs.StatelessDetector; public class ConstantListIndex extends BytecodeScanningDetector implements StatelessDetector { - - public static final int SEEN_NOTHING = 0; - public static final int SEEN_CONSTANT_0 = 1; - public static final int SEEN_CONSTANT = 2; + private static final String MAX_ICONST0_LOOP_DISTANCE_PROPERTY = "fb-contrib.cli.maxloopdistance"; + private static final int SEEN_NOTHING = 0; + private static final int SEEN_CONSTANT_0 = 1; + private static final int SEEN_CONSTANT = 2; private BugReporter bugReporter; private int state; private Set<Integer> iConst0Looped = new HashSet<Integer>(); + private int max_iConst0LoopDistance; /** * constructs a CLI detector given the reporter to report bugs on @@ -47,6 +48,7 @@ */ public ConstantListIndex(BugReporter bugReporter) { this.bugReporter = bugReporter; + max_iConst0LoopDistance = Integer.getInteger(MAX_ICONST0_LOOP_DISTANCE_PROPERTY, 30); } /** @@ -141,10 +143,12 @@ while (it.hasNext()) { int bugPC = it.next().intValue(); if (branchTarget < bugPC) { - bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this, bugPC)); + if ((bugPC - branchTarget) < max_iConst0LoopDistance) { + bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this, bugPC)); + } it.remove(); } } |
From: Dave B. <dbr...@us...> - 2006-01-18 03:11:46
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29534/src/com/mebigfatguy/fbcontrib/detect Modified Files: ConstantListIndex.java Log Message: don't report AALOADs in methods called 'main' Index: ConstantListIndex.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ConstantListIndex.java 18 Jan 2006 02:10:13 -0000 1.5 +++ ConstantListIndex.java 18 Jan 2006 03:11:38 -0000 1.6 @@ -94,11 +94,14 @@ case SEEN_CONSTANT_0: case SEEN_CONSTANT: switch (seen) { + case AALOAD: + if ("main".equals(this.getMethodName())) + break; + //FALL THRU case IALOAD: case LALOAD: case FALOAD: case DALOAD: - case AALOAD: //case BALOAD: byte and char indexing seems prevalent, and //case CALOAD: usually harmless so ignore case SALOAD: |
From: Dave B. <dbr...@us...> - 2006-01-18 02:10:24
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11611/src/com/mebigfatguy/fbcontrib/detect Modified Files: ConstantListIndex.java Log Message: remove pc's that have been reported, ignore caload and baloads Index: ConstantListIndex.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ConstantListIndex.java 17 Jan 2006 03:48:20 -0000 1.4 +++ ConstantListIndex.java 18 Jan 2006 02:10:13 -0000 1.5 @@ -99,8 +99,8 @@ case FALOAD: case DALOAD: case AALOAD: - case BALOAD: - case CALOAD: + //case BALOAD: byte and char indexing seems prevalent, and + //case CALOAD: usually harmless so ignore case SALOAD: if (state == SEEN_CONSTANT_0) iConst0Looped.add(new Integer(getPC())); @@ -142,6 +142,7 @@ .addClass(this) .addMethod(this) .addSourceLine(this, bugPC)); + it.remove(); } } } |
From: Dave B. <dbr...@us...> - 2006-01-17 04:41:29
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28907/src/com/mebigfatguy/fbcontrib/detect Modified Files: CopiedOverriddenMethod.java Log Message: javadoc fixes Index: CopiedOverriddenMethod.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CopiedOverriddenMethod.java 4 Jan 2006 02:40:42 -0000 1.5 +++ CopiedOverriddenMethod.java 17 Jan 2006 04:41:21 -0000 1.6 @@ -133,8 +133,8 @@ /** * 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 + * @param child the first code block + * @param parent the second code block * * @return whether the code blocks are the same */ |
From: Dave B. <dbr...@us...> - 2006-01-17 04:06:07
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19550/htdocs Modified Files: index.html Log Message: time to hilite the in-progress detectors Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -r1.53 -r1.54 --- index.html 17 Jan 2006 04:00:59 -0000 1.53 +++ index.html 17 Jan 2006 04:05:55 -0000 1.54 @@ -44,10 +44,10 @@ <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"/> + <img id="cvs_image" src="flip2.gif" onClick="toggleBlock('cvs', 'cvs_image');" align="top"/> Detectors added in CVS<br/> Note: these detectors are still in testing<br/> - <div id="cvs" style="display:none;"> + <div id="cvs" style="display:block;"> <ul> <li><b>Bloated Synchronized Block</b><br/> Looks for methods that implement synchronized blocks that appear to contain some code at @@ -62,9 +62,9 @@ </div> <hr/> - <img id="v2_0_0_image" src="flip2.gif" onClick="toggleBlock('v2_0_0', 'v2_0_0_image');" align="top"/> + <img id="v2_0_0_image" src="flip1.gif" onClick="toggleBlock('v2_0_0', 'v2_0_0_image');" align="top"/> Detectors added in v2.0.0<br/> - <div id="v2_0_0" style="display:block;"> + <div id="v2_0_0" style="display:none;"> <ul> <li><b>Array Based Collections</b><br/> Looks for methods that use arrays for items in the keyset of a map, or as |
From: Dave B. <dbr...@us...> - 2006-01-17 04:01:10
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17938/htdocs Modified Files: index.html Log Message: doc BSB Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- index.html 16 Jan 2006 05:05:03 -0000 1.52 +++ index.html 17 Jan 2006 04:00:59 -0000 1.53 @@ -49,12 +49,16 @@ Note: these detectors are still in testing<br/> <div id="cvs" style="display:none;"> <ul> + <li><b>Bloated Synchronized Block</b><br/> + Looks for methods that implement synchronized blocks that appear to contain some code at + the beginning that does not need to be synchronized. Moving these lines out of the synchronized + block should help multithreaded performance.</li> <li><b>Constant List Index</b><br/> - This method accesses an array or list using a constant integer index. Often, + Looks for methods that access an array or list using a constant integer index. Often, this is a typo where a loop variable is intended to be used. If however, specific list indices mean different specific things, then perhaps replacing the list with a first-class object with meaningful accessors would make the code less brittle.</li> - </ul> + </ul> </div> <hr/> |
From: Dave B. <dbr...@us...> - 2006-01-17 03:48:28
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14715/src/com/mebigfatguy/fbcontrib/detect Modified Files: ConstantListIndex.java Log Message: if a fetch on an array or list on literal 0 is in a loop, then report it. Index: ConstantListIndex.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ConstantListIndex.java 17 Jan 2006 02:54:52 -0000 1.3 +++ ConstantListIndex.java 17 Jan 2006 03:48:20 -0000 1.4 @@ -18,6 +18,10 @@ */ package com.mebigfatguy.fbcontrib.detect; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + import org.apache.bcel.classfile.Constant; import org.apache.bcel.classfile.ConstantInteger; import org.apache.bcel.classfile.Method; @@ -30,10 +34,12 @@ public class ConstantListIndex extends BytecodeScanningDetector implements StatelessDetector { public static final int SEEN_NOTHING = 0; - public static final int SEEN_CONSTANT = 1; + public static final int SEEN_CONSTANT_0 = 1; + public static final int SEEN_CONSTANT = 2; private BugReporter bugReporter; private int state; + private Set<Integer> iConst0Looped = new HashSet<Integer>(); /** * constructs a CLI detector given the reporter to report bugs on @@ -61,6 +67,7 @@ @Override public void visitMethod(Method obj) { state = SEEN_NOTHING; + iConst0Looped.clear(); } /** @@ -73,9 +80,9 @@ switch (state) { case SEEN_NOTHING: - //Unfortunately loading index 0 is a common thing when - //one object is expected to be returned in an array - if ((seen >= ICONST_1) && (seen <= ICONST_5)) + if (seen == ICONST_0) + state = SEEN_CONSTANT_0; + else if ((seen >= ICONST_1) && (seen <= ICONST_5)) state = SEEN_CONSTANT; else if (seen == LDC) { Constant c = getConstantRefOperand(); @@ -84,6 +91,7 @@ } break; + case SEEN_CONSTANT_0: case SEEN_CONSTANT: switch (seen) { case IALOAD: @@ -94,21 +102,28 @@ case BALOAD: case CALOAD: case SALOAD: - bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); - + if (state == SEEN_CONSTANT_0) + iConst0Looped.add(new Integer(getPC())); + else { + bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } break; case INVOKEVIRTUAL: if ("java/util/List".equals(getClassConstantOperand())) { String methodName = getNameConstantOperand(); if ("get".equals(methodName)) { - bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + if (state == SEEN_CONSTANT_0) + iConst0Looped.add(new Integer(getPC())); + else { + bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } break; @@ -116,5 +131,19 @@ state = SEEN_NOTHING; break; } + + if ((seen >= IFEQ) && (seen <= GOTO)) { + int branchTarget = this.getBranchTarget(); + Iterator<Integer> it = iConst0Looped.iterator(); + while (it.hasNext()) { + int bugPC = it.next().intValue(); + if (branchTarget < bugPC) { + bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this, bugPC)); + } + } + } } } |
From: Dave B. <dbr...@us...> - 2006-01-17 02:55:00
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3438/src/com/mebigfatguy/fbcontrib/detect Modified Files: ConstantListIndex.java Log Message: ignore loads of index 0 from an array, as this is common practice. Unfortunately this eliminates many cases where one is loading index 0 in a loop. Consider loop checking.... Index: ConstantListIndex.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ConstantListIndex.java 16 Jan 2006 06:21:04 -0000 1.2 +++ ConstantListIndex.java 17 Jan 2006 02:54:52 -0000 1.3 @@ -73,7 +73,9 @@ switch (state) { case SEEN_NOTHING: - if ((seen >= ICONST_0) && (seen <= ICONST_5)) + //Unfortunately loading index 0 is a common thing when + //one object is expected to be returned in an array + if ((seen >= ICONST_1) && (seen <= ICONST_5)) state = SEEN_CONSTANT; else if (seen == LDC) { Constant c = getConstantRefOperand(); |
From: Dave B. <dbr...@us...> - 2006-01-16 06:21:12
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8667/src/com/mebigfatguy/fbcontrib/detect Modified Files: ConstantListIndex.java Log Message: org imports Index: ConstantListIndex.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ConstantListIndex.java 16 Jan 2006 05:05:04 -0000 1.1 +++ ConstantListIndex.java 16 Jan 2006 06:21:04 -0000 1.2 @@ -25,7 +25,6 @@ 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 ConstantListIndex extends BytecodeScanningDetector implements StatelessDetector { |
From: Dave B. <dbr...@us...> - 2006-01-16 05:05:14
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30902/etc Modified Files: findbugs.xml messages.xml Log Message: initial checkin - new CLI detector Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- messages.xml 2 Jan 2006 03:41:07 -0000 1.44 +++ messages.xml 16 Jan 2006 05:05:03 -0000 1.45 @@ -382,6 +382,18 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex"> + <Details> + <![CDATA[ + <p>Looks for methods that access arrays or classes that implement java.util.List + using a constant integer for the index. This is often a typo intented to be a loop + variable, but if specific indices mean certain things, perhaps a first class object + would be a better choice for a container.</p> + <p>It is a fast Detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -746,6 +758,19 @@ to this object.</p> ]]> </Details> + </BugPattern> + + <BugPattern type="CLI_CONSTANT_LIST_INDEX"> + <ShortDescription>method accesses list or array with constant index</ShortDescription> + <LongDescription>method {1} accesses list or array with constant index</LongDescription> + <Details> + <![CDATA[ + <p>This method accesses an array or list using a constant integer index. Often, + this is a typo where a loop variable is intended to be used. If however, specific + list indices mean different specific things, then perhaps replacing the list with + a first-class object with meaningful accessors would make the code less brittle.</p> + ]]> + </Details> </BugPattern> @@ -780,4 +805,5 @@ <BugCode abbrev="AOM">Abstract Overridden Method</BugCode> <BugCode abbrev="CBX">Custom Built XML</BugCode> <BugCode abbrev="BSB">Bloated Synchronized Block</BugCode> + <BugCode abbrev="CLI">Constant List Index</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.52 retrieving revision 1.53 diff -u -d -r1.52 -r1.53 --- findbugs.xml 15 Jan 2006 23:45:00 -0000 1.52 +++ findbugs.xml 16 Jan 2006 05:05:03 -0000 1.53 @@ -129,6 +129,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" + speed="fast" + reports="CLI_CONSTANT_LIST_INDEX" /> <!-- BugPattern --> @@ -161,4 +165,5 @@ <BugPattern abbrev="AOM" type="AOM_ABSTRACT_OVERRIDDEN_METHOD" category="CORRECTNESS" /> <BugPattern abbrev="CBX" type="CBX_CUSTOM_BUILT_XML" category="STYLE" /> <BugPattern abbrev="BSB" type="BSB_BLOATED_SYNCHRONIZED_BLOCK" category="PERFORMANCE" experimental="true" /> + <BugPattern abbrev="CLI" type="CLI_CONSTANT_LIST_INDEX" category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2006-01-16 05:05:13
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30902/src/com/mebigfatguy/fbcontrib/detect Added Files: ConstantListIndex.java Log Message: initial checkin - new CLI detector --- NEW FILE: ConstantListIndex.java --- /* * fb-contrib - Auxilliary detectors for Java programs * Copyright (C) 2005-2006 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package com.mebigfatguy.fbcontrib.detect; import org.apache.bcel.classfile.Constant; import org.apache.bcel.classfile.ConstantInteger; import org.apache.bcel.classfile.Method; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.StatelessDetector; public class ConstantListIndex extends BytecodeScanningDetector implements StatelessDetector { public static final int SEEN_NOTHING = 0; public static final int SEEN_CONSTANT = 1; private BugReporter bugReporter; private int state; /** * constructs a CLI detector given the reporter to report bugs on * @param bugReporter the sync of bug reports */ public ConstantListIndex(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(); } /** * implements the visitor to reset the state * * @param obj the context object for the currently parsed code block */ @Override public void visitMethod(Method obj) { state = SEEN_NOTHING; } /** * implements the visitor to find accesses to lists or arrays using constants * * @param seen the currently visitor opcode */ @Override public void sawOpcode(int seen) { switch (state) { case SEEN_NOTHING: if ((seen >= ICONST_0) && (seen <= ICONST_5)) state = SEEN_CONSTANT; else if (seen == LDC) { Constant c = getConstantRefOperand(); if (c instanceof ConstantInteger) state = SEEN_CONSTANT; } break; case SEEN_CONSTANT: switch (seen) { case IALOAD: case LALOAD: case FALOAD: case DALOAD: case AALOAD: case BALOAD: case CALOAD: case SALOAD: bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); break; case INVOKEVIRTUAL: if ("java/util/List".equals(getClassConstantOperand())) { String methodName = getNameConstantOperand(); if ("get".equals(methodName)) { bugReporter.reportBug(new BugInstance(this, "CLI_CONSTANT_LIST_INDEX", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); } } break; } state = SEEN_NOTHING; break; } } } |
From: Dave B. <dbr...@us...> - 2006-01-16 05:05:13
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30902/htdocs Modified Files: index.html Log Message: initial checkin - new CLI detector Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- index.html 2 Jan 2006 00:47:35 -0000 1.51 +++ index.html 16 Jan 2006 05:05:03 -0000 1.52 @@ -48,6 +48,13 @@ Detectors added in CVS<br/> Note: these detectors are still in testing<br/> <div id="cvs" style="display:none;"> + <ul> + <li><b>Constant List Index</b><br/> + This method accesses an array or list using a constant integer index. Often, + this is a typo where a loop variable is intended to be used. If however, specific + list indices mean different specific things, then perhaps replacing the list with + a first-class object with meaningful accessors would make the code less brittle.</li> + </ul> </div> <hr/> |
From: Dave B. <dbr...@us...> - 2006-01-16 05:05:13
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30902/samples Added Files: CLI_Sample.java Log Message: initial checkin - new CLI detector --- NEW FILE: CLI_Sample.java --- public class CLI_Sample { public String test1(String[] sa) { String result = ""; for (int i = 0; i < sa.length; i++) result += sa[0]; return result; } public String test2(String[] sa) { String name = sa[0]; String address = sa[1]; String ss = sa[2]; return name + address + ss; } } |
From: Dave B. <dbr...@us...> - 2006-01-16 01:10:34
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19497/src/com/mebigfatguy/fbcontrib/detect Modified Files: BloatedSynchronizedBlock.java Log Message: calls on this, or static calls on this class, while in a sync block, are probably unsafe. Note static calls are probably only unsafe if the monitor is static, but for now be overly pessimistic. Index: BloatedSynchronizedBlock.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- BloatedSynchronizedBlock.java 7 Jan 2006 05:52:41 -0000 1.9 +++ BloatedSynchronizedBlock.java 16 Jan 2006 01:10:19 -0000 1.10 @@ -108,7 +108,7 @@ } else thisCallOccurred = false; } else if (seen == INVOKESTATIC) - thisCallOccurred = (getClassConstantOperand().equals(this.getClassContext().getJavaClass())); + thisCallOccurred = (getDottedClassConstantOperand().equals(this.getClassContext().getJavaClass().getClassName())); else thisCallOccurred = false; @@ -127,7 +127,9 @@ else if (seen == MONITOREXIT) syncPC = -1; else if (syncPC >= 0) { - boolean unsafe = ((seen == PUTFIELD) || (seen == GETFIELD) || (seen == GETSTATIC) || (seen == PUTSTATIC)); + //TODO: probably static calls are unsafe only if the monitor is on a static + boolean unsafe = thisCallOccurred; + unsafe |= ((seen == PUTFIELD) || (seen == GETFIELD) || (seen == GETSTATIC) || (seen == PUTSTATIC)); unsafe |= (!isStatic) && ((seen == ALOAD_0) || (seen == ASTORE_0)); int aloadReg = aloadReg(seen); unsafe |= (aloadReg >= 0) && unsafeAliases.contains(new Integer(aloadReg)); |
From: Dave B. <dbr...@us...> - 2006-01-15 23:45:10
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26035/etc Modified Files: findbugs.xml Log Message: back to 2.1.0 development Index: findbugs.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/findbugs.xml,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- findbugs.xml 14 Jan 2006 03:33:17 -0000 1.51 +++ findbugs.xml 15 Jan 2006 23:45:00 -0000 1.52 @@ -128,8 +128,7 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" - reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" - hidden="true" /> + reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" /> <!-- BugPattern --> |
From: Dave B. <dbr...@us...> - 2006-01-15 23:45:09
|
Update of /cvsroot/fb-contrib/fb-contrib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26035 Modified Files: build.xml Log Message: back to 2.1.0 development Index: build.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/build.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- build.xml 14 Jan 2006 03:33:17 -0000 1.25 +++ build.xml 15 Jan 2006 23:45:00 -0000 1.26 @@ -18,7 +18,7 @@ <property name="javac.deprecation" value="on"/> <property name="javac.debug" value="on"/> - <property name="fb-contrib.version" value="2.0.1"/> + <property name="fb-contrib.version" value="2.1.0"/> <target name="clean" description="removes all generated collateral"> <delete dir="${classes.dir}"/> |