fb-contrib-commit Mailing List for fb-contrib (Page 5)
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...> - 2013-02-06 05:02:36
|
Revision: 1740 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1740&view=rev Author: dbrosius Date: 2013-02-06 05:02:24 +0000 (Wed, 06 Feb 2013) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/htdocs/repository.html trunk/fb-contrib/pom.xml trunk/fb-contrib/samples/STB_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/build.xml 2013-02-06 05:02:24 UTC (rev 1740) @@ -17,7 +17,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="4.8.2" /> + <property name="fb-contrib.version" value="4.9.0" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/etc/findbugs.xml 2013-02-06 05:02:24 UTC (rev 1740) @@ -30,9 +30,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" /> <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" /> @@ -73,9 +73,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> @@ -176,9 +176,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> @@ -193,9 +193,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" /> <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> @@ -221,9 +221,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> @@ -236,6 +236,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_THROWS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList" speed="fast" reports="CAAL_CONFUSING_ARRAY_AS_LIST" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -410,4 +412,5 @@ <BugPattern abbrev="BRPI" type="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" category ="PERFORMANCE" /> <BugPattern abbrev="CU" type="CU_CLONE_USABILITY_OBJECT_RETURN" category="STYLE" /> <BugPattern abbrev="CU" type="CU_CLONE_USABILITY_THROWS" category="STYLE" /> + <BugPattern abbrev="CAAL" type="CAAL_CONFUSING_ARRAY_AS_LIST" category="CORRECTNESS" /> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/etc/messages.xml 2013-02-06 05:02:24 UTC (rev 1740) @@ -1281,6 +1281,17 @@ ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingArrayAsList"> + <Details> + <![CDATA[ + <p> Looks for calls to Arrays.asList where the parameter is a primitive array. + This does not produce a list that holds the primitive boxed values, but a list of + one item, the array itself. + </p> + ]]> + </Details> + </Detector> <!-- BugPattern --> @@ -3493,7 +3504,21 @@ ]]> </Details> </BugPattern> - + + <BugPattern type="CAAL_CONFUSING_ARRAY_AS_LIST"> + <ShortDescription>Method calls Array.asList on an array of primitive values</ShortDescription> + <LongDescription>Method {1} calls Array.asList on an array of primitive values</LongDescription> + <Details> + <![CDATA[ + <p> This method passes an array of primitive values to the Array.asList call. As primitive + values in arrays aren't automatically promoted to boxed primitives in arrays, the asList call + cannot convert this array in a list of boxed primitives. It therefore just creates an array + with one item in it, the array itself. This is rarely what is desired. + </p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -3602,4 +3627,5 @@ <BugCode abbrev="CCNE">Compare class name equals</BugCode> <BugCode abbrev="BRPI">Backport concurrent reuse of public identifiers</BugCode> <BugCode abbrev="CU">Clone Usability</BugCode> + <BugCode abbrev="CAAL">Confusing Array asList</BugCode> </MessageCollection> Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/htdocs/repository.html 2013-02-06 05:02:24 UTC (rev 1740) @@ -18,14 +18,16 @@ <p><a href="http://master.dl.sourceforge.net/project/fb-contrib/repo">http://master.dl.sourceforge.net/project/fb-contrib/repo</a></p> -<div style="width: 200px"> +<div style="width: 400px"> <table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;"> - <tr><td><b>GroupId:</b></td><td>com.mebigfatguy</td></tr> + <tr><td><b>GroupId:</b></td><td>com.mebigfatguy.fb-contrib</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> <tr><td><b>Version:</b></td><td>4.8.2</td></tr> </table> </div> +<p>fb-contrib is also now available at <a href="http://search.maven.org">search.maven.org</a></p> + </div> </body> </html> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/pom.xml 2013-02-06 05:02:24 UTC (rev 1740) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>4.8.2</version> + <version>4.9.0</version> <parent> <groupId>org.sonatype.oss</groupId> Modified: trunk/fb-contrib/samples/STB_Sample.java =================================================================== --- trunk/fb-contrib/samples/STB_Sample.java 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/samples/STB_Sample.java 2013-02-06 05:02:24 UTC (rev 1740) @@ -18,6 +18,38 @@ } } + public void testSTB2(File f1, File f2) throws STBException { + try { + InputStream is = new FileInputStream(f1); + } catch (IOException ioe) { + throw new STBException("It's broken"); + } + + try { + InputStream is = new FileInputStream(f2); + } catch (IOException ioe) { + throw new STBException("It's broken"); + } + } + + public void testSTB3(File f1, File f2) throws STBException { + try { + InputStream is = new FileInputStream(f1); + } catch (IOException ioe) { + STBException se = new STBException("It's broken"); + se.initCause(ioe); + throw se; + } + + try { + InputStream is = new FileInputStream(f2); + } catch (IOException ioe) { + STBException se = new STBException("It's broken"); + se.initCause(ioe); + throw se; + } + } + public void fpTestMethodDeclaresThrownType(File f1, File f2) throws STBException, IOException { try { InputStream is = new FileInputStream(f1); @@ -31,7 +63,7 @@ throw new STBException(); } } - + public void fpTestDiffMessages(File f1, File f2) throws STBException { try { InputStream is = new FileInputStream(f1); @@ -45,7 +77,7 @@ throw new STBException("Couldn't open file 2"); } } - + public void fpTestDiffMessagesByAppending(File f1, File f2) throws STBException { try { InputStream is = new FileInputStream(f1); @@ -61,10 +93,10 @@ } static class STBException extends Exception { - + public STBException() { } - + public STBException(String message) { super(message); } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2013-02-06 05:02:24 UTC (rev 1740) @@ -88,11 +88,11 @@ case ASTORE_1: case ASTORE_2: case ASTORE_3: - if(stack.getStackDepth() > 0){ - OpcodeStack.Item item = stack.getStackItem(0); + if(stack.getStackDepth() > 0) { LocalVariable lv = getMethod().getLocalVariableTable() .getLocalVariable(RegisterUtils.getAStoreReg(this, seen), getNextPC()); - if(lv != null){ + if(lv != null) { + OpcodeStack.Item item = stack.getStackItem(0); String sourceSignature = item.getSignature(); String targetSignature = lv.getSignature(); checkSignatures(sourceSignature, targetSignature); @@ -101,7 +101,7 @@ break; case PUTFIELD: case PUTSTATIC: - if(stack.getStackDepth() > 0){ + if(stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); String sourceSignature = item.getSignature(); String targetSignature = getSigConstantOperand(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2013-02-06 05:02:24 UTC (rev 1740) @@ -19,7 +19,9 @@ 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.classfile.Code; import org.apache.bcel.generic.Type; @@ -35,6 +37,13 @@ public class PossibleConstantAllocationInLoop extends BytecodeScanningDetector { + private static final Set<String> SYNTHETIC_ALLOCATION_CLASSES = new HashSet<String>(); + static { + SYNTHETIC_ALLOCATION_CLASSES.add("java/lang/StringBuffer"); + SYNTHETIC_ALLOCATION_CLASSES.add("java/lang/StringBuilder"); + SYNTHETIC_ALLOCATION_CLASSES.add("java/lang/AssertionError"); + } + private final BugReporter bugReporter; private OpcodeStack stack; /** allocation number, info where allocated */ @@ -119,7 +128,7 @@ case INVOKESPECIAL: if ("<init>".equals(getNameConstantOperand()) && "()V".equals(getSigConstantOperand())) { String clsName = getClassConstantOperand(); - if (!"java/lang/StringBuffer".equals(clsName) && !"java/lang/StringBuilder".equals(clsName)) { + if (!SYNTHETIC_ALLOCATION_CLASSES.contains(clsName)) { sawAllocationNumber = Integer.valueOf(nextAllocationNumber); allocations.put(sawAllocationNumber, new AllocationInfo(getPC())); sawAllocation = true; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java 2013-02-06 05:02:24 UTC (rev 1740) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2013 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 @@ -51,7 +51,7 @@ private static final String SAW_TEXT_LABEL = "SAW_TEXT_LABEL"; private static final String FROM_UIMANAGER = "FROM_UIMANAGER"; private static final String APPENDED_STRING = "APPENDED_STRING"; - + private static JavaClass windowClass; private static JavaClass componentClass; private static JavaClass jcomponentClass; @@ -83,16 +83,16 @@ clsNFException = cnfe; } } - + private static final Map<String, Integer> displayTextMethods = new HashMap<String, Integer>(); static { - displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;)", Integer.valueOf(0)); displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;Ljavax/swing/Icon;I)", Integer.valueOf(1)); displayTextMethods.put("javax/swing/JLabel#<init>(Ljava/lang/String;I)", Integer.valueOf(2)); - displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;)", Integer.valueOf(0)); - displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;Ljavax/swing/Icon;)", Integer.valueOf(1)); - displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;)", Integer.valueOf(0)); - displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;Ljava/awt/GraphicsConfiguration;)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JButton#<init>(Ljava/lang/String;Ljavax/swing/Icon;)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JFrame#<init>(Ljava/lang/String;Ljava/awt/GraphicsConfiguration;)", Integer.valueOf(1)); displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Dialog;Ljava/lang/String;)", Integer.valueOf(0)); displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Dialog;Ljava/lang/String;Z)", Integer.valueOf(1)); displayTextMethods.put("javax/swing/JDialog#<init>(Ljava/awt/Dialog;Ljava/lang/String;ZLjava/awt/GraphicsConfiguration;)", Integer.valueOf(2)); @@ -102,12 +102,12 @@ displayTextMethods.put("java/awt/Dialog#setTitle(Ljava/lang/String;)", Integer.valueOf(0)); displayTextMethods.put("java/awt/Frame#setTitle(Ljava/lang/String;)", Integer.valueOf(0)); displayTextMethods.put("javax/swing/JMenu#<init>(Ljava/lang/String;)", Integer.valueOf(0)); - displayTextMethods.put("javax/swing/JMenu#<init>(Ljava/lang/String;Z)", Integer.valueOf(1)); - displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;)", Integer.valueOf(0)); + displayTextMethods.put("javax/swing/JMenu#<init>(Ljava/lang/String;Z)", Integer.valueOf(1)); + displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;)", Integer.valueOf(0)); displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;Ljavax/swing/Icon;)", Integer.valueOf(1)); displayTextMethods.put("javax/swing/JMenuItem#<init>(Ljava/lang/String;I)", Integer.valueOf(1)); } - + private final BugReporter bugReporter; private OpcodeStack stack; private Set<XField> fieldLabels; @@ -125,7 +125,7 @@ /** * implements the visitor to create and clear the stack - * + * * @param classContext the context object of the currently visited class */ @Override @@ -161,7 +161,7 @@ /** * looks for fields that are JLabels and stores them in a set - * + * * @param obj the field object of the current field */ @Override @@ -176,7 +176,7 @@ /** * implements the visitor to reset the stack - * + * * @param obj the context object for the currently visited code block */ @Override @@ -199,7 +199,7 @@ /** * implements the visitor to find 508 compliance concerns - * + * * @param seen the opcode of the currently parsed instruction */ @Override @@ -239,7 +239,7 @@ } else if (seen == INVOKEVIRTUAL) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); - + if ("javax/swing/JLabel".equals(className)) { if ("setLabelFor".equals(methodName)) { if (stack.getStackDepth() > 1) { @@ -276,7 +276,7 @@ } } } - + processSetSizeOps(methodName); processNullLayouts(className, methodName); processSetColorOps(methodName); @@ -285,7 +285,7 @@ sawUIManager = true; } } - + if ((seen == INVOKEVIRTUAL) || (seen == INVOKESPECIAL) || (seen == INVOKEINTERFACE)) { processFaultyGuiStrings(); } @@ -304,7 +304,7 @@ if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(FROM_UIMANAGER); - } + } } else if (sawAppend) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); @@ -313,7 +313,7 @@ } } } - + /** * looks for calls to set a readable string that is generated from a static constant, as these strings * are not translatable. also looks for setting readable strings that are appended together. This is @@ -329,7 +329,7 @@ methodInfo.append(signature); Integer parmIndex = displayTextMethods.get(methodInfo.toString()); if (parmIndex != null) { - if (stack.getStackDepth() >= parmIndex.intValue()) { + if (stack.getStackDepth() > parmIndex.intValue()) { OpcodeStack.Item item = stack.getStackItem(parmIndex.intValue()); if (item.getConstant() != null) { bugReporter.reportBug(new BugInstance(this, "S508C_NON_TRANSLATABLE_STRING", NORMAL_PRIORITY) @@ -341,15 +341,15 @@ .addClass(this) .addMethod(this) .addSourceLine(this)); - + } } } } - + /** * looks for containers where a null layout is installed - * + * * @param className class that a method call is made on * @param methodName name of the method that is called */ @@ -368,12 +368,12 @@ } } } - + /** * looks for calls to set the color of components where the color isn't from UIManager - * + * * @param methodName the method that is called - * + * * @throws ClassNotFoundException if the gui component class can't be found */ private void processSetColorOps(String methodName) throws ClassNotFoundException { @@ -396,12 +396,12 @@ } } } - + /** * looks for calls to setSize on components, rather than letting the layout manager set them - * + * * @param methodName the method that was called on a component - * + * * @throws ClassNotFoundException if the gui class wasn't found */ private void processSetSizeOps(String methodName) throws ClassNotFoundException { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StackedTryBlocks.java 2013-02-06 05:02:24 UTC (rev 1740) @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; +import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.List; @@ -33,7 +34,7 @@ public class StackedTryBlocks extends BytecodeScanningDetector { private static JavaClass THROWABLE_CLASS; - + static { try { THROWABLE_CLASS = Repository.lookupClass("java.lang.Throwable"); @@ -44,6 +45,7 @@ private final BugReporter bugReporter; private List<TryBlock> blocks; private List<TryBlock> inBlocks; + private List<Integer> transitionPoints; private OpcodeStack stack; public StackedTryBlocks(BugReporter bugReporter) { @@ -72,6 +74,7 @@ blocks = new ArrayList<TryBlock>(); inBlocks = new ArrayList<TryBlock>(); + transitionPoints = new ArrayList<Integer>(); CodeException[] ces = obj.getExceptionTable(); for (CodeException ce : ces) { @@ -99,19 +102,23 @@ super.visitCode(obj); if (blocks.size() > 1) { - TryBlock firstBlock = blocks.get(0); + Collections.sort(transitionPoints); + + TryBlock firstBlock = blocks.get(0); for (int i = 1; i < blocks.size(); i++) { TryBlock secondBlock = blocks.get(i); - if ((firstBlock.getCatchType() == secondBlock.getCatchType()) - && (firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature()) - && ((firstBlock.getMessage().length() > 0) && firstBlock.getMessage().equals(secondBlock.getMessage()) - && (firstBlock.getExceptionSignature().equals(secondBlock.getExceptionSignature()))))) { - bugReporter.reportBug(new BugInstance(this, "STB_STACKED_TRY_BLOCKS", NORMAL_PRIORITY) - .addClass(this).addMethod(this) - .addSourceLineRange(this, firstBlock.getStartPC(), firstBlock.getEndHandlerPC()) - .addSourceLineRange(this, secondBlock.getStartPC(), secondBlock.getEndHandlerPC())); + if (!blocksSplitAcrossTransitions(firstBlock, secondBlock)) { + if ((firstBlock.getCatchType() == secondBlock.getCatchType()) + && (firstBlock.getThrowSignature().equals(secondBlock.getThrowSignature()) + && (firstBlock.getMessage().equals(secondBlock.getMessage()) + && (firstBlock.getExceptionSignature().equals(secondBlock.getExceptionSignature()))))) { + bugReporter.reportBug(new BugInstance(this, "STB_STACKED_TRY_BLOCKS", NORMAL_PRIORITY) + .addClass(this).addMethod(this) + .addSourceLineRange(this, firstBlock.getStartPC(), firstBlock.getEndHandlerPC()) + .addSourceLineRange(this, secondBlock.getStartPC(), secondBlock.getEndHandlerPC())); + } } firstBlock = secondBlock; @@ -121,6 +128,7 @@ } finally { blocks = null; inBlocks = null; + transitionPoints = null; } } @@ -129,6 +137,12 @@ String message = null; try { + if ((seen == TABLESWITCH) || (seen == LOOKUPSWITCH)) { + for (int offset : getSwitchOffsets()) { + transitionPoints.add(Integer.valueOf(offset)); + } + } + int pc = getPC(); TryBlock block = findBlockWithStart(pc); if (block != null) { @@ -178,16 +192,19 @@ if (exCls.instanceOf(THROWABLE_CLASS)) { String signature = getSigConstantOperand(); Type[] types = Type.getArgumentTypes(signature); - if ((types.length > 0) && "Ljava/lang/String;".equals(types[0].getSignature())) { - if (stack.getStackDepth() >= types.length) { - OpcodeStack.Item item = stack.getStackItem(types.length - 1); - message = (String)item.getConstant(); - if (message == null) { - message = "____UNKNOWN____" + System.currentTimeMillis(); - } + if (types.length > 0) { + if ("Ljava/lang/String;".equals(types[0].getSignature())) { + if (stack.getStackDepth() >= types.length) { + OpcodeStack.Item item = stack.getStackItem(types.length - 1); + message = (String)item.getConstant(); + if (message == null) { + message = "____UNKNOWN____" + System.identityHashCode(item); + } + } } + } else { + message = ""; } - } } } @@ -214,6 +231,22 @@ return null; } + private boolean blocksSplitAcrossTransitions(TryBlock firstBlock, TryBlock secondBlock) { + if (!transitionPoints.isEmpty()) { + Iterator<Integer> it = transitionPoints.iterator(); + while (it.hasNext()) { + Integer transitionPoint = it.next(); + if (transitionPoint.intValue() < firstBlock.handlerPC) { + it.remove(); + } else { + return transitionPoint.intValue() < secondBlock.handlerPC; + } + } + } + + return false; + } + static class TryBlock { public enum State { @@ -277,11 +310,11 @@ public void setExceptionSignature(String sig) { exSig = sig; } - + public void setThrowSignature(String sig) { throwSig = sig; } - + public void setMessage(String m) { message = m; } @@ -289,13 +322,13 @@ public String getExceptionSignature() { return (exSig == null) ? String.valueOf(System.identityHashCode(this)) : exSig; } - + public String getThrowSignature() { return (throwSig == null) ? String.valueOf(System.identityHashCode(this)) : throwSig; } - + public String getMessage() { - return (message == null) ? String.valueOf(System.identityHashCode(this)) : message; + return (message == null) ? String.valueOf(System.identityHashCode(this)) : message; } public int getStartPC() { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2013-01-30 06:57:26 UTC (rev 1739) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2013-02-06 05:02:24 UTC (rev 1740) @@ -85,14 +85,15 @@ public void visitCode(Code obj) { try { Method m = getMethod(); - String methodName = m.getName(); String signature = m.getSignature(); if (signature.endsWith(")Ljava/lang/Object;")) { - boolean isInherited = SignatureUtils.isInheritedMethod(currentClass, methodName, signature); stack.resetForMethodEntry(this); returnTypes.clear(); super.visitCode(obj); if (returnTypes.size() > 1) { + String methodName = m.getName(); + boolean isInherited = SignatureUtils.isInheritedMethod(currentClass, methodName, signature); + int priority = NORMAL_PRIORITY; for (JavaClass cls : returnTypes.keySet()) { if ((cls != null) && "java.lang.Object".equals(cls.getClassName())) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2013-01-30 06:57:32
|
Revision: 1739 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1739&view=rev Author: dbrosius Date: 2013-01-30 06:57:26 +0000 (Wed, 30 Jan 2013) Log Message: ----------- version 4.8.2 Modified Paths: -------------- tags/v4_8_1/fb-contrib/build.xml Added Paths: ----------- tags/v4_8_2/ Modified: tags/v4_8_1/fb-contrib/build.xml =================================================================== --- tags/v4_8_1/fb-contrib/build.xml 2013-01-30 06:53:29 UTC (rev 1738) +++ tags/v4_8_1/fb-contrib/build.xml 2013-01-30 06:57:26 UTC (rev 1739) @@ -19,6 +19,8 @@ <property name="fb-contrib.version" value="4.8.1" /> + <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> + <property name="findbugs.version" value="2.0.0" /> <property name="findbugs-bcel.version" value="2.0.0" /> <property name="annotations.version" value="2.0.0" /> @@ -221,4 +223,38 @@ <target name="release" depends="build, srczip, html, javadoc" description="prepares everything for a release" /> + <target name="sonatype" depends="release" description="prepare an artifact bundle for sonatype"> + <mkdir dir="${sonatype.dir}"/> + <copy todir="${sonatype.dir}" file="${basedir}/fb-contrib-${fb-contrib.version}.jar"/> + <copy tofile="${sonatype.dir}/fb-contrib-${fb-contrib.version}-sources.jar" file="${basedir}/fb-contrib-src-${fb-contrib.version}.zip"/> + <jar destfile="${sonatype.dir}/fb-contrib-${fb-contrib.version}-javadoc.jar" basedir="${basedir}" includes="javadoc/**"/> + <copy tofile="${sonatype.dir}/fb-contrib-${fb-contrib.version}.pom" file="${basedir}/pom.xml"/> + + <exec executable="gpg"> + <arg value="-abi" /> + <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}.jar" /> + </exec> + <exec executable="gpg"> + <arg value="-abi" /> + <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}.pom" /> + </exec> + <exec executable="gpg"> + <arg value="-abi" /> + <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}-sources.jar" /> + </exec> + <exec executable="gpg"> + <arg value="-abi" /> + <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}-javadoc.jar" /> + </exec> + <jar destfile="${sonatype.dir}/bundle.jar" basedir="${sonatype.dir}" includes="fb-contrib*"> + </jar> + <echo message="" /> + <echo message="" /> + <echo message="====================================================================================================================================" /> + <echo message="sonatype update bundle produced at ${sonatype.dir}/bundle.jar" /> + <echo message="upload this jar at https://oss.sonatype.org" /> + <echo message="" /> + <echo message="see link for details-> https://docs.sonatype.org/display/Repository/Uploading+3rd-party+Artifacts+to+The+Central+Repository" /> + <echo message="====================================================================================================================================" /> + </target> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2013-01-30 06:53:37
|
Revision: 1738 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1738&view=rev Author: dbrosius Date: 2013-01-30 06:53:29 +0000 (Wed, 30 Jan 2013) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/htdocs/index.shtml trunk/fb-contrib/htdocs/repository.html trunk/fb-contrib/pom.xml trunk/fb-contrib/samples/LO_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2013-01-29 08:07:07 UTC (rev 1737) +++ trunk/fb-contrib/build.xml 2013-01-30 06:53:29 UTC (rev 1738) @@ -17,7 +17,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="4.9.0" /> + <property name="fb-contrib.version" value="4.8.2" /> <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2013-01-29 08:07:07 UTC (rev 1737) +++ trunk/fb-contrib/etc/findbugs.xml 2013-01-30 06:53:29 UTC (rev 1738) @@ -30,9 +30,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" /> <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" /> @@ -73,9 +73,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> @@ -176,9 +176,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> @@ -193,9 +193,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" /> <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> @@ -221,9 +221,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2013-01-29 08:07:07 UTC (rev 1737) +++ trunk/fb-contrib/htdocs/index.shtml 2013-01-30 06:53:29 UTC (rev 1738) @@ -68,8 +68,8 @@ </li> </ul> </p> - <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.1 available for download - <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.1.jar/download">here</a>.</p> + <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.2 available for download + <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.2.jar/download">here</a>.</p> </div> <hr/> Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2013-01-29 08:07:07 UTC (rev 1737) +++ trunk/fb-contrib/htdocs/repository.html 2013-01-30 06:53:29 UTC (rev 1738) @@ -22,7 +22,7 @@ <table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;"> <tr><td><b>GroupId:</b></td><td>com.mebigfatguy</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>4.8.1</td></tr> + <tr><td><b>Version:</b></td><td>4.8.2</td></tr> </table> </div> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2013-01-29 08:07:07 UTC (rev 1737) +++ trunk/fb-contrib/pom.xml 2013-01-30 06:53:29 UTC (rev 1738) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>4.9.0</version> + <version>4.8.2</version> <parent> <groupId>org.sonatype.oss</groupId> Modified: trunk/fb-contrib/samples/LO_Sample.java =================================================================== --- trunk/fb-contrib/samples/LO_Sample.java 2013-01-29 08:07:07 UTC (rev 1737) +++ trunk/fb-contrib/samples/LO_Sample.java 2013-01-30 06:53:29 UTC (rev 1738) @@ -1,3 +1,5 @@ +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -4,19 +6,20 @@ import java.io.InputStream; import org.apache.log4j.Logger; +import org.apache.log4j.spi.LoggerFactory; @SuppressWarnings("all") -public class LO_Sample +public class LO_Sample { private static Logger l1 = Logger.getLogger(String.class); private static Logger l2 = Logger.getLogger("com.foo.LO_Sample"); - + public LO_Sample(Logger l3) { - + } - + public void testStutter() throws IOException { InputStream is = null; @@ -34,4 +37,18 @@ is.close(); } } + + public class Inner + { + public void fpUseAnon() { + ActionListener l = new ActionListener() + { + public void actionPerformed(ActionEvent ae) + { + Logger.getLogger(Inner.class).error("fp"); + Logger.getLogger(LO_Sample.class).error("not fp"); + } + }; + } + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2013-01-29 08:07:07 UTC (rev 1737) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2013-01-30 06:53:29 UTC (rev 1738) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2013 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 @@ -42,11 +42,11 @@ public class LoggerOddities extends BytecodeScanningDetector { private static JavaClass THROWABLE_CLASS; private static Set<String> loggerMethods; - + static { try { THROWABLE_CLASS = Repository.lookupClass("java/lang/Throwable"); - + loggerMethods = new HashSet<String>(); loggerMethods.add("trace"); loggerMethods.add("debug"); @@ -61,7 +61,7 @@ private final BugReporter bugReporter; private OpcodeStack stack; private String clsName; - + /** * constructs a LO detector given the reporter to report bugs on. @@ -70,12 +70,12 @@ public LoggerOddities(final BugReporter bugReporter) { this.bugReporter = bugReporter; } - - + + /** * implements the visitor to discover what the class name is if it is a normal class, * or the owning class, if the class is an anonymous class. - * + * * @param classContext the context object of the currently parsed class */ @Override @@ -100,10 +100,10 @@ stack = null; } } - + /** * implements the visitor to reset the stack - * + * * @param obj the context object of the currently parsed code block */ @Override @@ -127,17 +127,17 @@ } super.visitCode(obj); } - + /** * implements the visitor to look for calls to Logger.getLogger with the wrong class name - * + * * @param seen the opcode of the currently parsed instruction */ @Override public void sawOpcode(int seen) { String ldcClassName = null; int exMessageReg = -1; - + try { if ((seen == LDC) || (seen == LDC_W)) { Constant c = getConstantRefOperand(); @@ -148,13 +148,13 @@ } else if (seen == INVOKESTATIC) { String callingClsName = getClassConstantOperand(); String mthName = getNameConstantOperand(); - + String loggingClassName = null; if ("org/slf4j/LoggerFactory".equals(callingClsName) && "getLogger".equals(mthName)) { String signature = getSigConstantOperand(); - + if ("(Ljava/lang/Class;)Lorg/slf4j/Logger;".equals(signature)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); @@ -168,11 +168,11 @@ loggingClassName = loggingClassName.replace('.', '/'); } } - } + } } else if ("org/apache/log4j/Logger".equals(callingClsName) && "getLogger".equals(mthName)) { String signature = getSigConstantOperand(); - + if ("(Ljava/lang/Class;)Lorg/apache/log4j/Logger;".equals(signature)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); @@ -198,7 +198,7 @@ } else if ("org/apache/commons/logging/LogFactory".equals(callingClsName) && "getLog".equals(mthName)) { String signature = getSigConstantOperand(); - + if ("(Ljava/lang/Class;)Lorg/apache/commons/logging/Log;".equals(signature)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item item = stack.getStackItem(0); @@ -212,16 +212,27 @@ loggingClassName = loggingClassName.replace('.', '/'); } } - } + } } if (loggingClassName != null) { if (stack.getStackDepth() > 0) { if (!loggingClassName.equals(clsName)) { - bugReporter.reportBug(new BugInstance(this, "LO_SUSPECT_LOG_CLASS", (callingClsName.indexOf('$') >= 0) ? LOW_PRIORITY : NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + boolean isPrefix = clsName.startsWith(loggingClassName); + boolean isAnonClassPrefix; + if (isPrefix) { + String anonClass = clsName.substring(loggingClassName.length()); + isAnonClassPrefix = anonClass.matches("(\\$\\d+)+"); + } else { + isAnonClassPrefix = false; + } + + if (!isAnonClassPrefix) { + bugReporter.reportBug(new BugInstance(this, "LO_SUSPECT_LOG_CLASS", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } } } } @@ -244,7 +255,7 @@ if (stack.getStackDepth() >= 2) { OpcodeStack.Item exItem = stack.getStackItem(0); OpcodeStack.Item msgItem = stack.getStackItem(1); - + Integer exReg = (Integer)msgItem.getUserValue(); if (exReg != null) { if (exReg.intValue() == exItem.getRegisterNumber()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2013-01-29 08:07:23
|
Revision: 1737 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1737&view=rev Author: dbrosius Date: 2013-01-29 08:07:07 +0000 (Tue, 29 Jan 2013) Log Message: ----------- update from github Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SillynessPotPourri.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SloppyClassReflection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticArrayCreatedInMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StutteredMethodArguments.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousCloneAlgorithm.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousComparatorReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousGetterSetterUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousUninitializedArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousWaitOnConcurrentObject.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TailRecursion.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/TristateBooleanPattern.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseAddAll.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseEnumCollections.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseSplit.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseToArray.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseVarArgs.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WriteOnlyCollection.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/AttributesUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/CodeByteUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/MapEntry.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/SignatureUtils.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/TernaryPatcher.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/XClassUtils.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/FBContrib.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/Statistics.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractClassEmptyMethods.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbstractOverriddenMethod.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BackportReusePublicIdentifiers.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,7 +1,7 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Bhaskar Maddala - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Bhaskar Maddala + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BogusExceptionDeclaration.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,7 +1,7 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Bhaskar Maddala - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Bhaskar Maddala + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,7 +1,7 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Bhaskar Maddala - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Bhaskar Maddala + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,7 +1,7 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Bhaskar Maddala - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Bhaskar Maddala + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,7 +1,7 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Bhaskar Maddala - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Bhaskar Maddala + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingAutoboxedOverloading.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConfusingFunctionSemantics.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ConstantListIndex.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CopiedOverriddenMethod.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CyclomaticComplexity.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DateComparison.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeclaredRuntimeException.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeprecatedTypesafeEnumPattern.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousSetOfCollections.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -124,8 +124,9 @@ return; try { - cpg = new ConstantPoolGen(getConstantPool()); + cfg = clsContext.getCFG(obj); + cpg = cfg.getMethodGen().getConstantPool(); BasicBlock bb = cfg.getEntry(); Set<String> uncheckedFields = new HashSet<String>(localizableFields.keySet()); visitedBlocks.clear(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FinalParameters.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FloatingPointLoops.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ImproperPropertiesUse.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InappropriateToStringUse.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InconsistentKeyNameCasing.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/IncorrectInternalClassUse.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InheritanceTypeChecking.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JDBCVendorReliance.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/JUnitAssertionOddities.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LingeringGraphicsObjects.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LocalSynchronizedCollection.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LoggerOddities.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ManualArrayCopy.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MethodReturnsConstant.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MisleadingOverloadModel.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/MoreDumbMethods.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,7 +1,7 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Chris Peterson - * Copyright (C) 2005-2012 Jean-Noel Rouvignac + * Copyright (C) 2005-2013 Chris Peterson + * Copyright (C) 2005-2013 Jean-Noel Rouvignac * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessAutoboxing.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessCustomSerialization.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessInstanceRetrieval.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonCollectionMethodUse.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonRecycleableTaglibs.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonSymmetricEquals.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverzealousCasting.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleIncompleteSerialization.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleMemoryBloat.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleUnsuspectedSerialization.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2012-12-30 08:45:09 UTC (rev 1736) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ReflectionOnObjectMethods.java 2013-01-29 08:07:07 UTC (rev 1737) @@ -1,6 +1,6 @@ /* * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 Dave Brosius + * Copyright (C) 2005-2013 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public ... [truncated message content] |
From: <dbr...@us...> - 2012-12-30 08:45:16
|
Revision: 1736 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1736&view=rev Author: dbrosius Date: 2012-12-30 08:45:09 +0000 (Sun, 30 Dec 2012) Log Message: ----------- remove VersionTransition.java' Removed Paths: ------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/VersionTransition.java Deleted: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/VersionTransition.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/VersionTransition.java 2012-12-30 08:44:25 UTC (rev 1735) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/utils/VersionTransition.java 2012-12-30 08:45:09 UTC (rev 1736) @@ -1,28 +0,0 @@ -/* - * fb-contrib - Auxiliary detectors for Java programs - * Copyright (C) 2005-2012 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.utils; - - -/** - * supports different versions/changes to the FindBugs.jar file, by using reflection, etc - * to use different signatures. - */ -public class VersionTransition { - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-12-30 08:44:35
|
Revision: 1735 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1735&view=rev Author: dbrosius Date: 2012-12-30 08:44:25 +0000 (Sun, 30 Dec 2012) Log Message: ----------- sync from git Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/pom.xml trunk/fb-contrib/samples/BAS_Sample.java trunk/fb-contrib/samples/CCNE_Sample.java trunk/fb-contrib/samples/MRC_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/build.xml 2012-12-30 08:44:25 UTC (rev 1735) @@ -18,10 +18,13 @@ <property name="javac.debug" value="on" /> <property name="fb-contrib.version" value="4.9.0" /> + + <property name="sonatype.dir" value="${user.home}/.fb-contrib-${fb-contrib.version}-sonatype" /> + - <property name="findbugs.version" value="2.0.0" /> - <property name="findbugs-bcel.version" value="2.0.0" /> - <property name="annotations.version" value="2.0.0" /> + <property name="findbugs.version" value="2.0.1" /> + <property name="findbugs-bcel.version" value="2.0.1" /> + <property name="annotations.version" value="2.0.1" /> <property name="asm-tree.version" value="3.3.1" /> <property name="findbugs-url" value="http://repo1.maven.org/maven2/com/google/code/findbugs/findbugs/${findbugs.version}/findbugs-${findbugs.version}.jar" /> @@ -221,4 +224,38 @@ <target name="release" depends="build, srczip, html, javadoc" description="prepares everything for a release" /> + <target name="sonatype" depends="release" description="prepare an artifact bundle for sonatype"> + <mkdir dir="${sonatype.dir}"/> + <copy todir="${sonatype.dir}" file="${basedir}/fb-contrib-${fb-contrib.version}.jar"/> + <copy tofile="${sonatype.dir}/fb-contrib-${fb-contrib.version}-sources.jar" file="${basedir}/fb-contrib-src-${fb-contrib.version}.zip"/> + <jar destfile="${sonatype.dir}/fb-contrib-${fb-contrib.version}-javadoc.jar" basedir="${basedir}" includes="javadoc/**"/> + <copy tofile="${sonatype.dir}/fb-contrib-${fb-contrib.version}.pom" file="${basedir}/pom.xml"/> + + <exec executable="gpg"> + <arg value="-abi" /> + <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}.jar" /> + </exec> + <exec executable="gpg"> + <arg value="-abi" /> + <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}.pom" /> + </exec> + <exec executable="gpg"> + <arg value="-abi" /> + <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}-sources.jar" /> + </exec> + <exec executable="gpg"> + <arg value="-abi" /> + <arg value="${sonatype.dir}/fb-contrib-${fb-contrib.version}-javadoc.jar" /> + </exec> + <jar destfile="${sonatype.dir}/bundle.jar" basedir="${sonatype.dir}" includes="fb-contrib*"> + </jar> + <echo message="" /> + <echo message="" /> + <echo message="====================================================================================================================================" /> + <echo message="sonatype update bundle produced at ${sonatype.dir}/bundle.jar" /> + <echo message="upload this jar at https://oss.sonatype.org" /> + <echo message="" /> + <echo message="see link for details-> https://docs.sonatype.org/display/Repository/Uploading+3rd-party+Artifacts+to+The+Central+Repository" /> + <echo message="====================================================================================================================================" /> + </target> </project> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/etc/messages.xml 2012-12-30 08:44:25 UTC (rev 1735) @@ -3577,7 +3577,7 @@ <BugCode abbrev="SMA">Stuttered Method Arguments</BugCode> <BugCode abbrev="TBP">Tristate Boolean Pattern</BugCode> <BugCode abbrev="SUA">Suspicious Uninitialized Array</BugCode> - <BugCode abbrev="ITU">Inappropriate ToString Use</BugCode> + <BugCode abbrev="ITU">Inappropriate toString Use</BugCode> <BugCode abbrev="IKNC">Inconsistent Key Name Casing</BugCode> <BugCode abbrev="OC">Overzealous Casting</BugCode> <BugCode abbrev="PDP">Poorly Defined Parameter</BugCode> Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/pom.xml 2012-12-30 08:44:25 UTC (rev 1735) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>4.7.0</version> + <version>4.9.0</version> <parent> <groupId>org.sonatype.oss</groupId> @@ -91,7 +91,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> <artifactId>findbugs</artifactId> - <version>2.0.0</version> + <version>2.0.1</version> <scope>provided</scope> </dependency> </dependencies> Modified: trunk/fb-contrib/samples/BAS_Sample.java =================================================================== --- trunk/fb-contrib/samples/BAS_Sample.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/samples/BAS_Sample.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -1,5 +1,7 @@ import java.util.Calendar; +import java.util.Collection; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -151,4 +153,19 @@ System.out.println(delta); } } + + public String testFPIteratorNext(Collection<String> c, boolean b) { + Iterator<String> it = c.iterator(); + + String s = it.next(); + + if (b) { + if (s == null) { + return "yay"; + } + } + + return it.next(); + + } } Modified: trunk/fb-contrib/samples/CCNE_Sample.java =================================================================== --- trunk/fb-contrib/samples/CCNE_Sample.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/samples/CCNE_Sample.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -5,4 +5,11 @@ System.out.println(o.getClass().getName() .equals(p.getClass().getName())); } + + public void fpCompareAgainstString(String name) { + Object o = new CCNE_Sample(); + + if (o.getClass().getName().equals(name)) + System.out.println("booya"); + } } Modified: trunk/fb-contrib/samples/MRC_Sample.java =================================================================== --- trunk/fb-contrib/samples/MRC_Sample.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/samples/MRC_Sample.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -1,3 +1,4 @@ +import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -3,19 +4,19 @@ @SuppressWarnings("all") -public class MRC_Sample +public class MRC_Sample { private int getValue() { return 1; } - + private String getStringValue() { return "Hello"; } - + public float getFP() { return 0.0f; } - + private double getTwoValuesFP(boolean b) { @@ -25,23 +26,23 @@ else return 0.0; } - + private String getTwoDupsBySwitch(int i) { switch (i) { case 1: return "Hello"; - + case 2: return "Hello"; - + default: return "Hello"; } } - - + + private String fpStringBuilder() { StringBuilder sb = new StringBuilder(); @@ -49,12 +50,12 @@ return sb.toString(); } - + private void fooIt(StringBuilder sb) { sb.append("Foo"); } - + private int getCount(List<String> l) { int count = 0; @@ -66,14 +67,24 @@ count += 1; } } - + return count; } - + private int fpInc() { int i = 0; i++; return i; } + + private long fpCountChars(Collection<String> c) + { + long totLength = 0; + for (String s : c) + { + totLength += s.length(); + } + return totLength; + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/AbnormalFinallyBlockReturn.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -41,7 +41,7 @@ private final BugReporter bugReporter; private List<FinallyBlockInfo> fbInfo; private int loadedReg; - + /** * constructs a AFBR detector given the reporter to report bugs on. @@ -50,10 +50,10 @@ public AbnormalFinallyBlockReturn(final BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** * overrides the visitor to check for java class version being as good or better than 1.4 - * + * * @param classContext the context object that holds the JavaClass parsed */ @Override @@ -69,26 +69,26 @@ super.visitClassContext(classContext); } } finally { - fbInfo = null; + fbInfo = null; } } - + /** * overrides the visitor to collect finally block info. - * + * * @param obj the code object to scan for finally blocks */ @Override public void visitCode(Code obj) { fbInfo.clear(); loadedReg = -1; - + CodeException[] exc = obj.getExceptionTable(); if (exc != null) { for (CodeException ce : exc) { if ((ce.getCatchType() == 0) && (ce.getStartPC() == ce.getHandlerPC())) { - fbInfo.add(new FinallyBlockInfo(ce.getStartPC(), ce.getEndPC())); + fbInfo.add(new FinallyBlockInfo(ce.getStartPC())); } } } @@ -96,22 +96,22 @@ if (!fbInfo.isEmpty()) super.visitCode(obj); } - + /** * overrides the visitor to find return/exceptions from the finally block. - * + * * @param seen the opcode that is being visited */ @Override public void sawOpcode(int seen) { if (fbInfo.isEmpty()) return; - + FinallyBlockInfo fbi = fbInfo.get(0); - + if (getPC() < fbi.startPC) return; - + if (getPC() == fbi.startPC) { if (seen == ASTORE) fbi.exReg = getRegisterOperand(); @@ -124,7 +124,7 @@ } return; } - + if (seen == MONITORENTER) { fbi.monitorCount++; } else if (seen == MONITOREXIT) { @@ -135,11 +135,11 @@ return; } } - + if ((seen == ATHROW) && (loadedReg == fbi.exReg)) { fbInfo.remove(0); sawOpcode(seen); - return; + return; } else if (seen == ALOAD) loadedReg = getRegisterOperand(); @@ -147,7 +147,7 @@ loadedReg = seen - ALOAD_0; else loadedReg = -1; - + if (((seen >= IRETURN) && (seen <= RETURN)) || (seen == ATHROW)) { bugReporter.reportBug(new BugInstance( this, "AFBR_ABNORMAL_FINALLY_BLOCK_RETURN", NORMAL_PRIORITY) .addClass(this) @@ -175,14 +175,14 @@ } } } - + /** * finds the method in specified class by name and signature - * + * * @param cls the class to look the method in * @param name the name of the method to look for * @param sig the signature of the method to look for - * + * * @return the Method object for the specified information */ private Method findMethod(JavaClass cls, String name, String sig) { @@ -192,26 +192,26 @@ return m; } } - + return null; } - + /** * looks to see if any try/catch block exists inside this finally block, that - * wrap the current pc. This is a lax check as the try catch block may not - * catch exceptions that are thrown, but doing so would be prohibitively slow. + * wrap the current pc. This is a lax check as the try catch block may not + * catch exceptions that are thrown, but doing so would be prohibitively slow. * But it should catch some problems. - * + * * @param fBlockInfo the finally block the pc is currently in - * + * * @return if all exceptions are caught inside this finally block */ private boolean catchBlockInFinally(FinallyBlockInfo fBlockInfo) { - + CodeException[] catchExceptions = getCode().getExceptionTable(); if ((catchExceptions == null) || (catchExceptions.length == 0)) return false; - + int pc = getPC(); for (CodeException ex : catchExceptions) { if ((ex.getStartPC() <= pc) && (ex.getEndPC() >= pc)) { @@ -220,29 +220,26 @@ } } } - + return false; } - + /** * holds the finally block information for a particular method. */ public static class FinallyBlockInfo { public int startPC; - public int endPC; public int monitorCount; public int exReg; - + /** * create a finally block info for a specific code range - * + * * @param start the start of the try block - * @param end the end of the try block */ - public FinallyBlockInfo(int start, int end) { + public FinallyBlockInfo(int start) { startPC = start; - endPC = end; monitorCount = 0; exReg = -1; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -53,8 +53,9 @@ static { dangerousAssignmentClassSources.add("java/io/InputStream"); dangerousAssignmentClassSources.add("java/io/ObjectInput"); - dangerousAssignmentMethodSources - .add("java/lang/System.currentTimeMillis()J"); + dangerousAssignmentMethodSources.add("java/lang/System.currentTimeMillis()J"); + dangerousAssignmentMethodSources.add("java/util/Iterator.next()Ljava/lang/Object;"); + dangerousAssignmentMethodSources.add("java/util/regex/Matcher.start()I"); } BugReporter bugReporter; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsEqualsBuilderToEquals.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -2,17 +2,17 @@ * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 Bhaskar Maddala * Copyright (C) 2005-2012 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 @@ -30,7 +30,7 @@ /** * Find usage of EqualsBuilder from Apache commons, where the code invoke * equals() on the constructed object rather than isEquals() - * + * * <pre> * new EqualsBuilder().append(this.name, other.name).equals(other); * </pre> @@ -42,7 +42,7 @@ /** * constructs a CEBE detector given the reporter to report bugs on. - * + * * @param bugReporter * the sync of bug reports */ @@ -56,7 +56,7 @@ * initializers to the byte code scanning code. These methods are not * reported, but are used to build SourceLineAnnotations for fields, if * accessed. - * + * * @param obj * the context object of the currently parsed code attribute */ @@ -76,8 +76,8 @@ case INVOKEVIRTUAL: String methodName = getNameConstantOperand(); if ("equals".equals(methodName) - && "(Ljava/lang/Object;)Z" - .equals(getSigConstantOperand())) { + && "(Ljava/lang/Object;)Z".equals(getSigConstantOperand()) + && (stack.getStackDepth() > 1)) { String calledClass = stack.getStackItem(1).getSignature(); if ("Lorg/apache/commons/lang3/builder/EqualsBuilder;" .equals(calledClass) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsHashcodeBuilderToHashcode.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -2,17 +2,17 @@ * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 Bhaskar Maddala * Copyright (C) 2005-2012 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 @@ -30,7 +30,7 @@ /** * Find usage of HashCodeBuilder from Apache commons, where the code invokes * hashCode() on the constructed object rather than toHashCode() - * + * * <pre> * new HashCodeBuilder().append(this.name).hashCode(); * </pre> @@ -42,7 +42,7 @@ /** * constructs a CHTH detector given the reporter to report bugs on. - * + * * @param bugReporter * the sync of bug reports */ @@ -56,7 +56,7 @@ * initializers to the byte code scanning code. These methods are not * reported, but are used to build SourceLineAnnotations for fields, if * accessed. - * + * * @param obj * the context object of the currently parsed code attribute */ @@ -76,7 +76,8 @@ case INVOKEVIRTUAL: String methodName = getNameConstantOperand(); if ("hashCode".equals(methodName) - && "()I".equals(getSigConstantOperand())) { + && "()I".equals(getSigConstantOperand()) + && (stack.getStackDepth() > 0)) { String calledClass = stack.getStackItem(0).getSignature(); if ("Lorg/apache/commons/lang3/builder/HashCodeBuilder;" .equals(calledClass) Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CommonsStringBuilderToString.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -2,17 +2,17 @@ * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 Bhaskar Maddala * Copyright (C) 2005-2012 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 @@ -37,10 +37,10 @@ /** * Find usage of ToStringBuilder from Apache commons, where the code invokes * toString() on the constructed object without invoking append(). - * + * * Usage without invoking append is equivalent of using the Object.toString() * method - * + * * <pre> * new ToStringBuilder(this).toString(); * </pre> @@ -53,7 +53,7 @@ /** * constructs a CSBTS detector given the reporter to report bugs on. - * + * * @param bugReporter * the sync of bug reports */ @@ -126,12 +126,12 @@ case INVOKEVIRTUAL: String loadClassName = getClassConstantOperand(); String calledMethodName = getNameConstantOperand(); - String calledMethodSig = getSigConstantOperand(); if ("org/apache/commons/lang3/builder/ToStringBuilder" .equals(loadClassName) || "org/apache/commons/lang/builder/ToStringBuilder" .equals(loadClassName)) { + String calledMethodSig = getSigConstantOperand(); if ("<init>".equals(calledMethodName) && "(Ljava/lang/Object;)V".equals(calledMethodSig)) { stackTracker.add(new Pair(-1, false)); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -75,8 +75,10 @@ && "(Ljava/lang/Object;)Z".equals(getSigConstantOperand()) && "java/lang/String".equals(getClassConstantOperand())) { Item item = stack.getItemMethodInvokedOn(this); - Object userValue = item.getUserValue(); - if (userValue != null && Boolean.TRUE.equals(userValue)) { + Object srcValue = item.getUserValue(); + item = stack.getStackItem(0); + Object dstValue = item.getUserValue(); + if (Boolean.TRUE.equals(srcValue) && Boolean.TRUE.equals(dstValue)) { bugReporter .reportBug(new BugInstance(this, "CCNE_COMPARE_CLASS_EQUALS_NAME", Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -90,10 +90,10 @@ case ASTORE_3: if(stack.getStackDepth() > 0){ OpcodeStack.Item item = stack.getStackItem(0); - String sourceSignature = item.getSignature(); LocalVariable lv = getMethod().getLocalVariableTable() .getLocalVariable(RegisterUtils.getAStoreReg(this, seen), getNextPC()); if(lv != null){ + String sourceSignature = item.getSignature(); String targetSignature = lv.getSignature(); checkSignatures(sourceSignature, targetSignature); } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -34,7 +34,7 @@ /** * looks for methods that build xml based strings by concatenation strings - * and custom values together. Doing so makes brittle code, that is difficult to + * and custom values together. Doing so makes brittle code, that is difficult to * modify, validate and understand. It is cleaner to create external xml files that are * transformed at runtime, using parameters set through Transformer.setParameter. */ @@ -51,7 +51,7 @@ xmlPatterns.put(Pattern.compile("^[\"']>.*"), Boolean.TRUE); xmlPatterns.put(Pattern.compile(".*<!\\[CDATA\\[.*", Pattern.CASE_INSENSITIVE), Boolean.TRUE); xmlPatterns.put(Pattern.compile(".*\\]\\]>.*"), Boolean.TRUE); - xmlPatterns.put(Pattern.compile(".*xmlns:.*"), Boolean.TRUE); + xmlPatterns.put(Pattern.compile(".*xmlns:.*"), Boolean.TRUE); } private static final String CBX_MIN_REPORTABLE_ITEMS = "fb-contrib.cbx.minxmlitems"; private BugReporter bugReporter; @@ -62,7 +62,7 @@ private int midReportingThreshold; private int highReportingThreshold; private int firstPC; - + /** * constructs a CBX detector given the reporter to report bugs on @@ -70,15 +70,15 @@ */ public CustomBuiltXML(BugReporter bugReporter) { this.bugReporter = bugReporter; - + lowReportingThreshold = Integer.getInteger(CBX_MIN_REPORTABLE_ITEMS, 5).intValue(); midReportingThreshold = lowReportingThreshold << 1; highReportingThreshold = lowReportingThreshold << 2; } - + /** * overrides the visitor to create and destroy the stack - * + * * @param classContext the context object of the currently parsed class */ @Override @@ -90,12 +90,12 @@ stack = null; } } - + /** * overrides the visitor reset the opcode stack - * + * * @param obj the code object of the currently parsed method - */ + */ @Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); @@ -103,7 +103,7 @@ xmlConfidentCount = 0; firstPC = -1; super.visitCode(obj); - if ((xmlItemCount >= lowReportingThreshold) + if ((xmlItemCount >= lowReportingThreshold) && (xmlConfidentCount > (lowReportingThreshold >> 1))) { bugReporter.reportBug( new BugInstance( this, "CBX_CUSTOM_BUILT_XML", @@ -113,22 +113,22 @@ .addClass(this) .addMethod(this) .addSourceLine(this, firstPC)); - + } } - + /** * overrides the visitor to find String concatenations including xml strings - * + * * @param seen the opcode that is being visited - */ + */ @Override public void sawOpcode(int seen) { String strCon = null; - + try { stack.mergeJumps(this); - + if (seen == INVOKESPECIAL) { String clsName = getClassConstantOperand(); if ("java/lang/StringBuffer".equals(clsName) || "java/lang/StringBuilder".equals(clsName)) { @@ -154,11 +154,12 @@ } } } - + if (strCon != null) { - if (strCon.trim().length() == 0) + strCon = strCon.trim(); + if (strCon.length() == 0) return; - + for (Map.Entry<Pattern, Boolean> entry : xmlPatterns.entrySet()) { Matcher m = entry.getKey().matcher(strCon); if (m.matches()) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonOwnedSynchronization.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -51,14 +51,14 @@ private BugReporter bugReporter; private OpcodeStack stack; private Map<Integer, Integer> regPriorities; - + /** * constructs a NOS detector given the reporter to report bugs on * @param bugReporter the sync of bug reports */ public NonOwnedSynchronization(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** * implements the visitor to set and clear the stack and priorities */ @@ -73,10 +73,10 @@ regPriorities = null; } } - + /** * looks for methods that contain a MONITORENTER opcode - * + * * @param method the context object of the current method * @return if the class uses synchronization */ @@ -84,10 +84,10 @@ BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return bytecodeSet != null && (bytecodeSet.get(Constants.MONITORENTER)); } - + /** * implements the visitor to reset the opcode stack - * + * * @param obj the context object of the currently parsed code block */ @Override @@ -104,10 +104,10 @@ super.visitCode(obj); } } - + /** * implements the visitor to look for synchronization on non-owned objects - * + * * @param seen the opcode of the currently parsed instruction */ @Override @@ -115,12 +115,12 @@ Integer tosIsPriority = null; try { stack.mergeJumps(this); - + switch (seen) { case GETFIELD: tosIsPriority = OWNED; break; - + case ALOAD: case ALOAD_0: case ALOAD_1: @@ -136,7 +136,7 @@ } } break; - + case ASTORE: case ASTORE_0: case ASTORE_1: @@ -149,14 +149,14 @@ } } break; - + case INVOKEVIRTUAL: case INVOKEINTERFACE: { String sig = getSigConstantOperand(); Type t = Type.getReturnType(sig); if (t.getSignature().startsWith("L")) { int parmCnt = Type.getArgumentTypes(sig).length; - if (stack.getStackDepth() >= parmCnt) { + if (stack.getStackDepth() > parmCnt) { OpcodeStack.Item itm = stack.getStackItem(parmCnt); Integer priority = (Integer)itm.getUserValue(); if ((priority != null) && OWNED.equals(priority)) { @@ -172,7 +172,7 @@ } } break; - + case INVOKESTATIC: { String sig = getSigConstantOperand(); Type t = Type.getReturnType(sig); @@ -180,7 +180,7 @@ tosIsPriority = OWNED; // can't be sure } break; - + case INVOKESPECIAL: { String name = getNameConstantOperand(); if ("<init>".equals(name)) { @@ -188,7 +188,7 @@ } } break; - + case MONITORENTER: { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousJDKVersionUse.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -67,16 +67,15 @@ } private static final Pattern jarPattern = Pattern.compile("jar:file:/*([^!]*)"); private static final String SJVU_JDKHOME = "fb-contrib.sjvu.jdkhome"; - + private final Map<String, File> versionPaths; private final Map<Integer, Map<String, Set<String>>> validMethodsByVersion; private final Map<String, String> superNames; private File jdksRoot = null; private ZipFile jdkZip; - private JavaClass cls; private Integer clsMajorVersion; - private final BugReporter bugReporter; - + private final BugReporter bugReporter; + public SuspiciousJDKVersionUse(BugReporter bugReporter) { this.bugReporter = bugReporter; versionPaths = new HashMap<String, File>(); @@ -87,12 +86,11 @@ @Override public void visitClassContext(ClassContext classContext) { try { - cls = classContext.getJavaClass(); - clsMajorVersion = Integer.valueOf(cls.getMajor()); + clsMajorVersion = Integer.valueOf(classContext.getJavaClass().getMajor()); File rtJar = getRTJarFile(); if (rtJar == null) rtJar = getRTJarFromProperty(); - + if (rtJar != null) { jdkZip = new ZipFile(rtJar); super.visitClassContext(classContext); @@ -109,7 +107,6 @@ } catch (IOException ioe) { //Hmm What to do } finally { - cls = null; clsMajorVersion = null; try { if (jdkZip != null) @@ -119,10 +116,10 @@ jdkZip = null; } } - + @Override public void sawOpcode(int seen) { - + String clsName; try { if ((seen == INVOKEVIRTUAL) //Interfaces are more difficult, ignore for now @@ -134,13 +131,13 @@ Method m = findCalledMethod(); if (m == null) return; - + Map<String, Set<String>> validMethods = validMethodsByVersion.get(clsMajorVersion); if (validMethods == null) { validMethods = new HashMap<String, Set<String>>(); validMethodsByVersion.put(clsMajorVersion, validMethods); } - + if (!isValid(validMethods, clsName)) { bugReporter.reportBug(new BugInstance(this, "SJVU_SUSPICIOUS_JDK_VERSION_USE", HIGH_PRIORITY) .addClass(this) @@ -156,7 +153,7 @@ //Hmm what do do. } } - + private Method findCalledMethod() { try { JavaClass clss = Repository.lookupClass(getClassConstantOperand()); @@ -168,7 +165,7 @@ return m; } } - + return null; } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); @@ -178,23 +175,23 @@ private boolean isValid(Map<String, Set<String>> validMethods, String clsName) throws IOException, ClassNotFoundException { InputStream is = null; - + try { Set<String> methodInfos = validMethods.get(clsName); if (methodInfos == null) { - + ZipEntry ze = jdkZip.getEntry(clsName + ".class"); if (ze != null) { is = new BufferedInputStream(jdkZip.getInputStream(ze)); ClassParser parser = new ClassParser(is, clsName); JavaClass calledClass = parser.parse(); - + superNames.put(clsName, calledClass.getSuperclassName().replace('.', '/')); Method[] methods = calledClass.getMethods(); - + methodInfos = new HashSet<String>(); validMethods.put(clsName, methodInfos); - + for (Method m : methods) { methodInfos.add(m.getName() + m.getSignature()); } @@ -206,7 +203,7 @@ .addClass(clsName)); } } - + if (methodInfos != null) { String wantedMethod = getNameConstantOperand() + getSigConstantOperand(); if (methodInfos.contains(wantedMethod)) @@ -216,7 +213,7 @@ else return isValid(validMethods, superNames.get(clsName)); } - + return true; } finally { @@ -228,21 +225,21 @@ } } } - + private File getRTJarFile(){ String versionStr = verRegEx.get(clsMajorVersion); if (versionStr == null) return null; - + File rtPath = versionPaths.get(versionStr); if (rtPath != null) return rtPath; - + if (jdksRoot == null) { URL jdkUrl = SuspiciousJDKVersionUse.class.getResource("/java/lang/Object.class"); if (jdkUrl != null) { Matcher m = jarPattern.matcher(jdkUrl.toExternalForm()); - + if (m.find()) { String path = m.group(1); jdksRoot = new File(path); @@ -252,10 +249,10 @@ jdksRoot = jdksRoot.getParentFile(); m = verPat.matcher(jdksRoot.getName()); } - + if (jdksRoot.getParentFile() == null) return null; - + try { String encoding = System.getProperty("file.encoding"); jdksRoot = new File(URLDecoder.decode(jdksRoot.getParentFile().getPath(), encoding)); @@ -265,7 +262,7 @@ } } } - + if (jdksRoot != null) { File[] possibleJdks = jdksRoot.listFiles(); for (File possibleJdk : possibleJdks) { @@ -283,22 +280,22 @@ } } } - + return null; } - + private File getRTJarFromProperty() { String jdkHome = System.getProperty(SJVU_JDKHOME); if (jdkHome == null) return null; - + File rtJar = new File(jdkHome, "lib/rt.jar"); if (rtJar.exists()) return rtJar; rtJar = new File(jdkHome, "jre/lib/rt.jar"); if (rtJar.exists()) return rtJar; - + return null; } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -40,11 +40,11 @@ * or variable is null. */ public class SuspiciousNullGuard extends BytecodeScanningDetector { - + private final BugReporter bugReporter; private OpcodeStack stack; private Map<Integer, NullGuard> nullGuards; - + /** * constructs a SNG detector given the reporter to report bugs on * @param bugReporter the sync of bug reports @@ -52,10 +52,10 @@ public SuspiciousNullGuard(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** * overrides the visitor to initialize and tear down the opcode stack - * + * * @param classContext the context object of the currently parsed class */ @Override @@ -68,10 +68,10 @@ stack = null; } } - + /** * overrides the visitor to reset the stack - * + * * @param obj the context object of the currently parsed code block */ @Override @@ -80,10 +80,10 @@ nullGuards.clear(); super.visitCode(obj); } - + /** * overrides the visitor to look for bad null guards - * + * * @param seen the opcode of the currently visited instruction */ @Override @@ -91,7 +91,7 @@ try { Integer pc = Integer.valueOf(getPC()); nullGuards.remove(pc); - + switch (seen) { case IFNULL: { if (stack.getStackDepth() > 0) { @@ -109,7 +109,7 @@ } } break; - + case ASTORE: case ASTORE_0: case ASTORE_1: @@ -130,7 +130,7 @@ } } break; - + case ALOAD: case ALOAD_0: case ALOAD_1: @@ -142,7 +142,7 @@ } } break; - + case PUTFIELD: { if (stack.getStackDepth() > 1) { OpcodeStack.Item item = stack.getStackItem(0); @@ -162,7 +162,7 @@ } } break; - + case GETFIELD: { if (stack.getStackDepth() > 0) { XField xf = getXFieldOperand(); @@ -175,7 +175,7 @@ } } break; - + case IFEQ: case IFNE: case IFLT: @@ -200,27 +200,27 @@ stack.sawOpcode(this, seen); } } - + private NullGuard findNullGuardWithRegister(int reg) { for (NullGuard guard : nullGuards.values()) { if (guard.getRegister() == reg) { return guard; } } - + return null; } - + private NullGuard findNullGuardWithField(XField field) { for (NullGuard guard : nullGuards.values()) { if (field.equals(guard.getField())) { return guard; } } - + return null; } - + private void removeNullGuard(NullGuard guard) { Iterator<NullGuard> it = nullGuards.values().iterator(); while (it.hasNext()) { @@ -231,14 +231,13 @@ } } } - + static class NullGuard { int register; XField field; int location; String signature; - boolean sawSignature = false; - + public NullGuard(int reg, int start, String guardSignature) { register = reg; field = null; @@ -257,15 +256,15 @@ public int getRegister() { return register; } - + public XField getField() { return field; } - + public int getLocation() { return location; } - + public String getSignature() { return signature; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedReturnValues.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -39,27 +39,26 @@ /** * looks for methods that return Object, and who's code body returns two or more - * different types of objects that are unrelated (other than by Object). + * different types of objects that are unrelated (other than by Object). */ -public class UnrelatedReturnValues extends BytecodeScanningDetector +public class UnrelatedReturnValues extends BytecodeScanningDetector { private final BugReporter bugReporter; private OpcodeStack stack; private JavaClass currentClass; private Map<JavaClass, Integer> returnTypes; - private boolean isInherited; - + /** * constructs a URV detector given the reporter to report bugs on * @param bugReporter the sync of bug reports - */ + */ public UnrelatedReturnValues(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** * implements the visitor to create and destroy the stack and return types - * + * * @param classContext the context object of the currently parsed class */ @Override @@ -79,7 +78,7 @@ /** * implements the visitor to see if the method returns Object, and if the method * is defined in a superclass, or interface. - * + * * @param obj the context object of the currently parsed code block */ @Override @@ -89,7 +88,7 @@ String methodName = m.getName(); String signature = m.getSignature(); if (signature.endsWith(")Ljava/lang/Object;")) { - isInherited = SignatureUtils.isInheritedMethod(currentClass, methodName, signature); + boolean isInherited = SignatureUtils.isInheritedMethod(currentClass, methodName, signature); stack.resetForMethodEntry(this); returnTypes.clear(); super.visitCode(obj); @@ -101,7 +100,7 @@ break; } } - + JavaClass cls = findCommonType(returnTypes.keySet()); BugInstance bug; if ((cls != null) && !isInherited) { @@ -112,11 +111,11 @@ } else if (!isInherited) { bug = new BugInstance(this, "URV_UNRELATED_RETURN_VALUES", priority) .addClass(this) - .addMethod(this); + .addMethod(this); } else { bug = new BugInstance(this, "URV_INHERITED_METHOD_WITH_RELATED_TYPES", priority) .addClass(this) - .addMethod(this); + .addMethod(this); if (cls != null) bug.addString(cls.getClassName()); } @@ -132,11 +131,11 @@ bugReporter.reportMissingClass(cnfe); } } - + /** - * implements the visitor to find return values where the types of objects returned from the + * implements the visitor to find return values where the types of objects returned from the * method are related only by object. - * + * * @param seen the opcode of the currently parsed instruction */ @Override @@ -156,10 +155,10 @@ stack.sawOpcode(this, seen); } } - + /** * looks for a common superclass or interface for all the passed in types - * + * * @param classes the set of classes to look for a common super class or interface * @return the type that is the common interface or superclass (not Object, tho). */ @@ -170,10 +169,10 @@ for (JavaClass cls : classes) { if (cls == null) //array return null; - + if ("java/lang/Object".equals(cls.getClassName())) continue; - + JavaClass[] infs = cls.getAllInterfaces(); JavaClass[] supers = cls.getSuperClasses(); if (populate) { @@ -188,10 +187,10 @@ possibleCommonTypes.retainAll(retain); } } - + if (possibleCommonTypes.isEmpty()) return null; - + for (JavaClass cls : possibleCommonTypes) { if (cls.isInterface()) return cls; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java 2012-12-30 07:51:38 UTC (rev 1734) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WeakExceptionMessaging.java 2012-12-30 08:44:25 UTC (rev 1735) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -39,23 +39,23 @@ import edu.umd.cs.findbugs.ba.ClassContext; public class WeakExceptionMessaging extends BytecodeScanningDetector { - + private static JavaClass exceptionClass; private static final Set<String> ignorableExceptionTypes = new HashSet<String>(); - + static { try { exceptionClass = Repository.lookupClass("java/lang/Exception"); } catch (ClassNotFoundException cnfe) { exceptionClass = null; } - + ignorableExceptionTypes.add("java.lang.UnsupportedOperationException"); } - + private final BugReporter bugReporter; private OpcodeStack stack; - + /** * constructs a WEM detector given the reporter to report bugs on * @param bugReporter the sync of bug reports @@ -63,10 +63,10 @@ public WeakExceptionMessaging(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** * overrides the visitor to initialize and tear down the opcode stack - * + * * @param classContext the context object of the currently parsed class */ @Override @@ -80,10 +80,10 @@ stack = null; } } - + /** * looks for methods that contain a ATHROW opcodes - * + * * @param method the context object of the current method * @return if the class uses throws */ @@ -91,11 +91,11 @@ BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Constants.ATHROW)); } - + /** * overrides the visitor to prescreen the method to look for throws calls * and only forward onto bytecode scanning if there - * + * * @param obj the context object of the currently parsed code block */ @Override @@ -108,11 +108,11 @@ } } } - + /** * overrides the visitor to look for throws instructions using exceptions with * static messages - * + * * @param seen the opcode of the currently visited instruction */ @Override @@ -125,7 +125,7 @@ OpcodeStack.Item item = stack.getStackItem(0); if (item.getUserValue() != null) { JavaClass exClass = item.getJavaClass(); - if ((exClass == null) || !ignorableExceptionTypes.contains(item.getJavaClass().getClassName())) { + if ((exClass == null) || !ignorableExceptionTypes.contains(exClass.getClassName())) { bugReporter.reportBug(new BugInstance(this, "WEM_WEAK_EXCEPTION_MESSAGING", LOW_PRIORITY) .addClass(this) .addMethod(this) @@ -134,7 +134,7 @@ } } } else if ((seen == LDC) || (seen == LDC_W)) { - if (getConstantRefOperand() instanceof ConstantString) + if (getConstantRefOperand() instanceof ConstantString) sawConstant = true; } else if (seen == INVOKESPECIAL) { if ("<init>".equals(getNameConstantOperand())) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-12-30 07:51:45
|
Revision: 1734 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1734&view=rev Author: dbrosius Date: 2012-12-30 07:51:38 +0000 (Sun, 30 Dec 2012) Log Message: ----------- add missing class Added Paths: ----------- tags/v4_8_1/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java Added: tags/v4_8_1/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java =================================================================== --- tags/v4_8_1/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java (rev 0) +++ tags/v4_8_1/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java 2012-12-30 07:51:38 UTC (rev 1734) @@ -0,0 +1,110 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2012 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.Repository; +import org.apache.bcel.classfile.ExceptionTable; +import org.apache.bcel.classfile.JavaClass; +import org.apache.bcel.classfile.Method; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.Detector; +import edu.umd.cs.findbugs.ba.ClassContext; +import edu.umd.cs.findbugs.visitclass.PreorderVisitor; + +/** + * finds classes that implement clone() that do not specialize the return value, and do + * not swallow CloneNotFoundException. Not doing so makes the clone method not as simple + * to use, and should be harmless to do. + */ +public class CloneUsability extends PreorderVisitor implements Detector { + + private static JavaClass CLONE_CLASS; + + static { + try { + CLONE_CLASS = Repository.lookupClass("java.lang.Cloneable"); + } catch (ClassNotFoundException cnfe) { + CLONE_CLASS = null; + } + } + + private BugReporter bugReporter; + private String clsName; + + /** + * constructs a CU detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ + public CloneUsability(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + /** + * overrides the visitor to check for classes that implement Cloneable. + * + * @param classContext the context object that holds the JavaClass being parsed + */ + public void visitClassContext(ClassContext classContext) { + try { + JavaClass cls = classContext.getJavaClass(); + if (cls.implementationOf(CLONE_CLASS)) { + clsName = cls.getClassName(); + cls.accept(this); + } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); + } + } + + /** + * overrides the visitor to grab the method name and reset the state. + * + * @param obj the method being parsed + */ + @Override + public void visitMethod(Method obj) { + if (obj.isPublic() && !obj.isSynthetic() && obj.getName().equals("clone") && (obj.getArgumentTypes().length == 0)) { + + String returnClsName = obj.getReturnType().getSignature(); + returnClsName = returnClsName.substring(1, returnClsName.length() - 1).replaceAll("/", "."); + if (!clsName.equals(returnClsName)) + { + bugReporter.reportBug(new BugInstance(this, "CU_CLONE_USABILITY_OBJECT_RETURN", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this)); + } + + ExceptionTable et = obj.getExceptionTable(); + + if ((et != null) && (et.getLength() > 0)) { + bugReporter.reportBug(new BugInstance(this, "CU_CLONE_USABILITY_THROWS", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this)); + } + } + } + + /** + * implements the Detector with a nop + */ + public void report() { + } +} Property changes on: tags/v4_8_1/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CloneUsability.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: 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...> - 2012-12-30 07:50:28
|
Revision: 1733 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1733&view=rev Author: dbrosius Date: 2012-12-30 07:50:21 +0000 (Sun, 30 Dec 2012) Log Message: ----------- fix version numbers Modified Paths: -------------- tags/v4_8_1/fb-contrib/build.xml tags/v4_8_1/fb-contrib/pom.xml Modified: tags/v4_8_1/fb-contrib/build.xml =================================================================== --- tags/v4_8_1/fb-contrib/build.xml 2012-11-22 19:51:34 UTC (rev 1732) +++ tags/v4_8_1/fb-contrib/build.xml 2012-12-30 07:50:21 UTC (rev 1733) @@ -35,7 +35,7 @@ <property name="junit.version" value="4.10" /> <property name="log4j.version" value="1.2.16" /> <property name="servlet-api.version" value="3.0.1" /> - <property name="backport-concurrent.version" value="3.1" /> + <property name="backport-util-concurrent.version" value="3.1" /> <property name="commons-collections.version" value="3.2.1" /> <property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar" /> @@ -43,7 +43,7 @@ <property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar" /> <property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar" /> <property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar" /> - <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-concurrent/backport-concurrent/${backport-concurrent.version}/backport-concurrent-${backport-concurrent.version}.jar" /> + <property name="backport-util-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-util-concurrent.version}/backport-util-concurrent-${backport-util-concurrent.version}.jar" /> <property name="commons-collections-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" /> <target name="check"> @@ -80,7 +80,7 @@ <pull url="${junit-url}" dest="${sampleslib.dir}" name="junit" version="${junit.version}" /> <pull url="${log4j-url}" dest="${sampleslib.dir}" name="log4j" version="${log4j.version}" /> <pull url="${servlet-api-url}" dest="${sampleslib.dir}" name="servlet-api" version="${servlet-api.version}" /> - <pull url="${backport-concurrent-url}" dest="${sampleslib.dir}" name="backport-concurrent" version="${backport-concurrent.version}" /> + <pull url="${backport-util-concurrent-url}" dest="${sampleslib.dir}" name="backport-util-concurrent" version="${backport-util-concurrent.version}" /> <pull url="${commons-collections-url}" dest="${sampleslib.dir}" name="commons-collections" version="${commons-collections.version}" /> </target> @@ -116,7 +116,7 @@ <pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar" /> <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" /> <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" /> - <pathelement location="${sampleslib.dir}/backport-concurrent-${backport-concurrent.version}.jar" /> + <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" /> </path> <mkdir dir="${classes.dir}/com" /> <mkdir dir="${classes.dir}/com/mebigfatguy" /> Modified: tags/v4_8_1/fb-contrib/pom.xml =================================================================== --- tags/v4_8_1/fb-contrib/pom.xml 2012-11-22 19:51:34 UTC (rev 1732) +++ tags/v4_8_1/fb-contrib/pom.xml 2012-12-30 07:50:21 UTC (rev 1733) @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>com.mebigfatguy.fb-contrib</groupId> <artifactId>fb-contrib</artifactId> - <version>4.7.0</version> + <version>4.8.1</version> <parent> <groupId>org.sonatype.oss</groupId> @@ -91,7 +91,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> <artifactId>findbugs</artifactId> - <version>1.3.9</version> + <version>2.0.0</version> <scope>provided</scope> </dependency> </dependencies> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-11-22 19:51:41
|
Revision: 1732 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1732&view=rev Author: dbrosius Date: 2012-11-22 19:51:34 +0000 (Thu, 22 Nov 2012) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.xml Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2012-11-22 02:21:35 UTC (rev 1731) +++ trunk/fb-contrib/.classpath 2012-11-22 19:51:34 UTC (rev 1732) @@ -10,8 +10,8 @@ <classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/> <classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/> <classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/> - <classpathentry kind="lib" path="samples/lib/backport-concurrent-3.1.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/> <classpathentry kind="lib" path="samples/lib/commons-collections-3.2.1.jar"/> + <classpathentry kind="lib" path="samples/lib/backport-util-concurrent-3.1.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-11-22 02:21:35 UTC (rev 1731) +++ trunk/fb-contrib/build.xml 2012-11-22 19:51:34 UTC (rev 1732) @@ -35,7 +35,7 @@ <property name="junit.version" value="4.10" /> <property name="log4j.version" value="1.2.16" /> <property name="servlet-api.version" value="3.0.1" /> - <property name="backport-concurrent.version" value="3.1" /> + <property name="backport-util-concurrent.version" value="3.1" /> <property name="commons-collections.version" value="3.2.1" /> <property name="commons-lang3-url" value="http://repo1.maven.org/maven2/org/apache/commons/commons-lang3/${commons-lang3.version}/commons-lang3-${commons-lang3.version}.jar" /> @@ -43,7 +43,7 @@ <property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar" /> <property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar" /> <property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar" /> - <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-concurrent/backport-concurrent/${backport-concurrent.version}/backport-concurrent-${backport-concurrent.version}.jar" /> + <property name="backport-util-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-util-concurrent.version}/backport-util-concurrent-${backport-util-concurrent.version}.jar" /> <property name="commons-collections-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" /> <target name="check"> @@ -80,7 +80,7 @@ <pull url="${junit-url}" dest="${sampleslib.dir}" name="junit" version="${junit.version}" /> <pull url="${log4j-url}" dest="${sampleslib.dir}" name="log4j" version="${log4j.version}" /> <pull url="${servlet-api-url}" dest="${sampleslib.dir}" name="servlet-api" version="${servlet-api.version}" /> - <pull url="${backport-concurrent-url}" dest="${sampleslib.dir}" name="backport-concurrent" version="${backport-concurrent.version}" /> + <pull url="${backport-util-concurrent-url}" dest="${sampleslib.dir}" name="backport-util-concurrent" version="${backport-util-concurrent.version}" /> <pull url="${commons-collections-url}" dest="${sampleslib.dir}" name="commons-collections" version="${commons-collections.version}" /> </target> @@ -116,7 +116,7 @@ <pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar" /> <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" /> <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" /> - <pathelement location="${sampleslib.dir}/backport-concurrent-${backport-concurrent.version}.jar" /> + <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-util-concurrent.version}.jar" /> </path> <mkdir dir="${classes.dir}/com" /> <mkdir dir="${classes.dir}/com/mebigfatguy" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-11-22 02:21:42
|
Revision: 1731 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1731&view=rev Author: dbrosius Date: 2012-11-22 02:21:35 +0000 (Thu, 22 Nov 2012) Log Message: ----------- sync with github Modified Paths: -------------- trunk/fb-contrib/plugin.xml Modified: trunk/fb-contrib/plugin.xml =================================================================== --- trunk/fb-contrib/plugin.xml 2012-11-22 01:43:55 UTC (rev 1730) +++ trunk/fb-contrib/plugin.xml 2012-11-22 02:21:35 UTC (rev 1731) @@ -1,11 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.4"?> <plugin> - <extension - point="edu.umd.cs.findbugs.plugin.eclipse.detectorPlugins"> - <detectorPlugin - libraryPath="."> - </detectorPlugin> - </extension> - + <extension point="edu.umd.cs.findbugs.plugin.eclipse.findbugsPlugins"> + <findbugsPlugin fbPluginId="com.mebigfatguy.fbcontrib" libraryPath="."></findbugsPlugin> + </extension> </plugin> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-11-22 01:44:02
|
Revision: 1730 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1730&view=rev Author: dbrosius Date: 2012-11-22 01:43:55 +0000 (Thu, 22 Nov 2012) Log Message: ----------- sync with github Modified Paths: -------------- trunk/fb-contrib/.project trunk/fb-contrib/build.properties trunk/fb-contrib/pom.xml trunk/fb-contrib/samples/CVAA_Sample.java trunk/fb-contrib/samples/UNNC_Sample.java trunk/fb-contrib/samples/UVA_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java Modified: trunk/fb-contrib/.project =================================================================== --- trunk/fb-contrib/.project 2012-10-31 17:32:54 UTC (rev 1729) +++ trunk/fb-contrib/.project 2012-11-22 01:43:55 UTC (rev 1730) @@ -32,4 +32,15 @@ <nature>org.eclipse.pde.PluginNature</nature> <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature> </natures> + <filteredResources> + <filter> + <id>1351977185587</id> + <name>samples</name> + <type>10</type> + <matcher> + <id>org.eclipse.ui.ide.multiFilter</id> + <arguments>1.0-name-matches-false-false-.svn</arguments> + </matcher> + </filter> + </filteredResources> </projectDescription> Modified: trunk/fb-contrib/build.properties =================================================================== --- trunk/fb-contrib/build.properties 2012-10-31 17:32:54 UTC (rev 1729) +++ trunk/fb-contrib/build.properties 2012-11-22 01:43:55 UTC (rev 1730) @@ -4,5 +4,6 @@ . jars.compile.order = . source.. = src/,\ - etc/ -output.. = bin/ + etc/,\ + samples/ +output.. = classes/ Modified: trunk/fb-contrib/pom.xml =================================================================== --- trunk/fb-contrib/pom.xml 2012-10-31 17:32:54 UTC (rev 1729) +++ trunk/fb-contrib/pom.xml 2012-11-22 01:43:55 UTC (rev 1730) @@ -91,7 +91,7 @@ <dependency> <groupId>com.google.code.findbugs</groupId> <artifactId>findbugs</artifactId> - <version>1.3.9</version> + <version>2.0.0</version> <scope>provided</scope> </dependency> </dependencies> Modified: trunk/fb-contrib/samples/CVAA_Sample.java =================================================================== --- trunk/fb-contrib/samples/CVAA_Sample.java 2012-10-31 17:32:54 UTC (rev 1729) +++ trunk/fb-contrib/samples/CVAA_Sample.java 2012-11-22 01:43:55 UTC (rev 1730) @@ -1,3 +1,4 @@ +import java.util.HashSet; import java.util.Set; @@ -27,7 +28,12 @@ return new Derived(); } + public void generics() { + Set<String>[] myStringSets = new HashSet[2]; + Set<String>[] myStringSets2 = new Set[2]; + } + public String fpVarArgs(String s1, Set<String> s2) { return String.format("s1=%s s2=%s", s1, s2); } -} \ No newline at end of file +} Modified: trunk/fb-contrib/samples/UNNC_Sample.java =================================================================== --- trunk/fb-contrib/samples/UNNC_Sample.java 2012-10-31 17:32:54 UTC (rev 1729) +++ trunk/fb-contrib/samples/UNNC_Sample.java 2012-11-22 01:43:55 UTC (rev 1730) @@ -5,8 +5,7 @@ public class UNNC_Sample { - - @SuppressWarnings("null") + public void testPosNEW() { UNNC_Sample sample = new UNNC_Sample(); @@ -16,7 +15,6 @@ } } - @SuppressWarnings("null") public void testNegNEW() { UNNC_Sample sample = new UNNC_Sample(); @@ -28,7 +26,6 @@ System.out.println("OK"); } - @SuppressWarnings("null") public void testPosANEWARAY() { String[] s = new String[10]; @@ -37,7 +34,6 @@ } } - @SuppressWarnings("null") public void testNegANEWARRAY() { String[] s = new String[10]; @@ -48,7 +44,6 @@ System.out.println("OK"); } - @SuppressWarnings("null") public void testPosMULTIANEWARRAY() { String[][] s = new String[10][5]; @@ -57,7 +52,6 @@ } } - @SuppressWarnings("null") public void testNegMULTIANEWARRAY() { String[][] s = new String[10][5]; Modified: trunk/fb-contrib/samples/UVA_Sample.java =================================================================== --- trunk/fb-contrib/samples/UVA_Sample.java 2012-10-31 17:32:54 UTC (rev 1729) +++ trunk/fb-contrib/samples/UVA_Sample.java 2012-11-22 01:43:55 UTC (rev 1730) @@ -4,35 +4,37 @@ public class UVA_Sample<T> extends ArrayList<T> { - public void testNormalUVA(String[] foo) + private static final long serialVersionUID = -7860932685876390245L; + + public void testNormalUVA(String[] foo) {} - + public void testLowUVA1(int boo, String[] hoo) {} - + public static void testStaticUVA(Date[] d) {} - + public void fpNoParms() {} - + public void fpHasOtherArrayUVA1(String[] one, int[] two) {} - + public void fpTooManyArgs(int i, char j, long k, String[] moo) {} - + public void fpNotAtEnd(String[] foo, int bar) {} - + public void fpAlreadyVarArg(String...darnit) {} - + public void fpSimilarVarArg(String info, String...data) {} - + @Override - public <T> T[] toArray(T[] a) + public <E> E[] toArray(E[] a) { return null; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2012-10-31 17:32:54 UTC (rev 1729) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2012-11-22 01:43:55 UTC (rev 1730) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -27,23 +27,23 @@ public class CollectStatistics extends BytecodeScanningDetector implements NonReportingDetector { private int numMethodCalls; - - public CollectStatistics(@SuppressWarnings("unused") BugReporter bugReporter) { + + public CollectStatistics(BugReporter bugReporter) { Statistics.getStatistics().clear(); } - + @Override public void visitCode(Code obj) { - + numMethodCalls = 0; - + byte[] code = obj.getCode(); if (code != null) { super.visitCode(obj); Statistics.getStatistics().addMethodStatistics(getClassName(), getMethodName(), getMethodSig(), new Statistics.MethodInfo(code.length, numMethodCalls)); } } - + @Override public void sawOpcode(int seen) { switch (seen) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2012-10-31 17:32:54 UTC (rev 1729) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2012-11-22 01:43:55 UTC (rev 1730) @@ -142,15 +142,17 @@ } if ((seen == INVOKEINTERFACE) || (seen == INVOKEVIRTUAL) || ((seen == INVOKESPECIAL))) { //ignore possible method chaining - OpcodeStack.Item item = stack.getStackItem(types.length); - Integer allocation = (Integer)item.getUserValue(); - if (allocation != null) { - String retType = Type.getReturnType(signature).getSignature(); - if (!"V".equals(retType) && retType.equals(item.getSignature())) { - sawAllocationNumber = allocation; - sawAllocation = true; + if (stack.getStackDepth() > types.length) { + OpcodeStack.Item item = stack.getStackItem(types.length); + Integer allocation = (Integer)item.getUserValue(); + if (allocation != null) { + String retType = Type.getReturnType(signature).getSignature(); + if (!"V".equals(retType) && retType.equals(item.getSignature())) { + sawAllocationNumber = allocation; + sawAllocation = true; + } } - } + } } } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-31 17:33:09
|
Revision: 1729 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1729&view=rev Author: dbrosius Date: 2012-10-31 17:32:54 +0000 (Wed, 31 Oct 2012) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/samples/CVAA_Sample.java trunk/fb-contrib/samples/DWI_Sample.java trunk/fb-contrib/samples/LEST_Sample.java trunk/fb-contrib/samples/SMII_Sample.java trunk/fb-contrib/samples/USBR_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryNewNullCheck.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnnecessaryStoreBeforeReturn.java Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/.classpath 2012-10-31 17:32:54 UTC (rev 1729) @@ -9,17 +9,6 @@ <classpathentry kind="lib" path="samples/lib/junit-4.10.jar"/> <classpathentry kind="lib" path="samples/lib/log4j-1.2.16.jar"/> <classpathentry kind="lib" path="samples/lib/servlet-api-3.0.1.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-3.3.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-analysis-3.3.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-commons-3.3.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-tree-3.3.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-util-3.3.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/bcel.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/dom4j-1.6.1.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/findbugs.jar" sourcepath="/findbugs"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jaxen-1.1.1.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jFormatString.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jsr305.jar"/> <classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/> <classpathentry kind="lib" path="samples/lib/backport-concurrent-3.1.jar"/> <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/build.xml 2012-10-31 17:32:54 UTC (rev 1729) @@ -17,7 +17,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="4.8.1" /> + <property name="fb-contrib.version" value="4.9.0" /> <property name="findbugs.version" value="2.0.0" /> <property name="findbugs-bcel.version" value="2.0.0" /> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/etc/findbugs.xml 2012-10-31 17:32:54 UTC (rev 1729) @@ -30,9 +30,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" /> <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" /> @@ -73,9 +73,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> @@ -176,9 +176,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> @@ -193,9 +193,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" /> <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> @@ -221,9 +221,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> @@ -334,7 +334,7 @@ <BugPattern abbrev="SPP" type="SPP_EMPTY_CASING" category="STYLE" /> <BugPattern abbrev="SPP" type="SPP_TEMPORARY_TRIM" category="STYLE" /> <BugPattern abbrev="BAS" type="BAS_BLOATED_ASSIGNMENT_SCOPE" category="PERFORMANCE" /> - <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR" category="STYLE" /> + <BugPattern abbrev="SCII" type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" category="STYLE" /> <BugPattern abbrev="DWI" type="DWI_DELETING_WHILE_ITERATING" category="CORRECTNESS" /> <BugPattern abbrev="DWI" type="DWI_MODIFYING_WHILE_ITERATING" category="CORRECTNESS" /> <BugPattern abbrev="USS" type="USS_USE_STRING_SPLIT" category="STYLE" /> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/etc/messages.xml 2012-10-31 17:32:54 UTC (rev 1729) @@ -2547,7 +2547,7 @@ </Details> </BugPattern> - <BugPattern type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTATOR"> + <BugPattern type="SCII_SPOILED_CHILD_INTERFACE_IMPLEMENTOR"> <ShortDescription>Class implements interface by relying on unknowing superclass methods</ShortDescription> <LongDescription>Class {0} implements interface by relying on unknowing superclass methods</LongDescription> <Details> Modified: trunk/fb-contrib/samples/CVAA_Sample.java =================================================================== --- trunk/fb-contrib/samples/CVAA_Sample.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/samples/CVAA_Sample.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -1,13 +1,15 @@ +import java.util.Set; + public class CVAA_Sample { Base[] b2; class Base {} - + class Derived extends Base {} - + public void cvaa() - { + { Derived[] d2 = new Derived[4]; Base[] b = d2; b2 = d2; @@ -16,12 +18,16 @@ b[1] = doDerived(); b[2] = null; b[3] = d; - + Integer[] a = new Integer[1]; System.arraycopy(a[0], 0, a, 1, 1); } - + private Derived doDerived(){ return new Derived(); } + + public String fpVarArgs(String s1, Set<String> s2) { + return String.format("s1=%s s2=%s", s1, s2); + } } \ No newline at end of file Modified: trunk/fb-contrib/samples/DWI_Sample.java =================================================================== --- trunk/fb-contrib/samples/DWI_Sample.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/samples/DWI_Sample.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -3,10 +3,10 @@ import java.util.Iterator; import java.util.Set; -public class DWI_Sample +public class DWI_Sample { Set<String> avail; - + public void deleteOdds(Set<Integer> bagOInts) { Iterator<Integer> it = bagOInts.iterator(); @@ -17,7 +17,7 @@ bagOInts.remove(i); } } - + public void addIf(Set<String> s, Collection<String> c) { for (String ss : s) { @@ -25,7 +25,7 @@ s.addAll(c); } } - + public void fpUnaliased() { Iterator<String> it = avail.iterator(); @@ -36,7 +36,7 @@ avail.add(it.next() + "booya"); } } - + public void fpWithBreak(Set<String> ss) { for (String s : ss) @@ -47,4 +47,15 @@ } } } + + public void fpClearWithBreak(Set<String> ss) + { + for (String s : ss) + { + if (s.equals("foo")) { + ss.clear(); + break; + } + } + } } Modified: trunk/fb-contrib/samples/LEST_Sample.java =================================================================== --- trunk/fb-contrib/samples/LEST_Sample.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/samples/LEST_Sample.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -1,3 +1,4 @@ +import java.io.IOException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -139,6 +140,26 @@ } } + public void testLestFP3510540() throws Exception + { + boolean bool = true; + if (bool) + { + try + { + throw new IOException(); + } + catch (IOException ioe) + { + throw new Exception(ioe); + } + } + else + { + throw new Exception("message"); + } + } + private Exception wrap(Exception e) { return new Exception(e); } Modified: trunk/fb-contrib/samples/SMII_Sample.java =================================================================== --- trunk/fb-contrib/samples/SMII_Sample.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/samples/SMII_Sample.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -6,72 +6,82 @@ public class SMII_Sample { private Inner i = new Inner(); - + public static void static_empty() { } - + public static void static_one(String s) { } - + public void test_empty(SMII_Sample smii) { smii.static_empty(); } - + public void test_empty2(SMII_Sample smii) { smii.static_one("foo".toUpperCase()); } - - public SMII_Sample getSMI() + + public SMII_Sample getSMI() { return new SMII_Sample(); } - + public void test_chaining() { new SMII_Sample().getSMI().static_one("hello"); } - + public void test_dotclass() { Set s = new HashSet(); s.add(String.class); } - + public void test_ClassForName() throws ClassNotFoundException { Class c = Class.forName("java.lang.Object"); } - + public void test_ClassGetName() { String name = Object.class.getName(); } - + public void avoidGeneratedMethods(final Inner inner) { inner.next = null; } - + public static class Inner { - private Inner next; + private Inner next; } - - public void testFPInstance(SMII_Sample sample) + + public static SMII_Sample fp1() { + SMII_Sample s = new SMII_Sample(); + + SMII_Sample.fp1(); + SMII_Sample.fp1(); + + return s; + } + + public void testFP2Instance(SMII_Sample sample) + { SMII_Sample.testInstanceAsFirstParm(sample, ""); SMII_Sample.testInstanceAsFirstParm(""); } - + public static SMII_Sample testInstanceAsFirstParm(String s1) { return new SMII_Sample(); } - + public static SMII_Sample testInstanceAsFirstParm(SMII_Sample sample, String s1) { return sample; Modified: trunk/fb-contrib/samples/USBR_Sample.java =================================================================== --- trunk/fb-contrib/samples/USBR_Sample.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/samples/USBR_Sample.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -10,17 +10,17 @@ { sum += Integer.parseInt(s); } - + int ave = sum / tokens.length; return ave; } - + public int dontReport(int j) { int i; try { - i = 0; + i = 0; i = i / j; } catch (Exception e) @@ -29,7 +29,7 @@ } return i; } - + public Exception fpReturnException(String num) { try @@ -42,7 +42,7 @@ return e; } } - + public int fpPlusEquals() { int i = 0; @@ -50,4 +50,10 @@ i+= dontReport(i); return i; } + + public boolean fpOrEquals(boolean b) + { + b |= fpOrEquals(b); + return b; + } } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -70,7 +70,7 @@ /** * constructs a BAS detector given the reporter to report bugs on - * + * * @param bugReporter * the sync of bug reports */ @@ -81,7 +81,7 @@ /** * implements the visitor to create and the clear the register to location * map - * + * * @param classContext * the context object of the currently parsed class */ @@ -105,7 +105,7 @@ /** * implements the visitor to reset the register to location map - * + * * @param obj * the context object of the currently parsed code block */ @@ -152,7 +152,7 @@ /** * implements the visitor to look for variables assigned below the scope in * which they are used. - * + * * @param seen * the opcode of the currently parsed instruction */ @@ -372,7 +372,7 @@ /** * returns either a register number of a field reference of the object that * a method is being called on, or null, if it can't be determined. - * + * * @return either an Integer for a register, or a String for the field name, * or null */ @@ -407,7 +407,7 @@ /** * returns the scope block in which this register was assigned, by * traversing the scope block tree - * + * * @param sb * the scope block to start searching in * @param pc @@ -433,12 +433,12 @@ /** * returns an existing scope block that has the same target as the one * looked for - * + * * @param sb * the scope block to start with * @param target * the target to look for - * + * * @return the scope block found or null */ private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start, @@ -479,7 +479,7 @@ /** * construts a new scope block - * + * * @param start * the beginning of the block * @param finish @@ -499,7 +499,7 @@ /** * returns a string representation of the scope block - * + * * @returns a string representation */ @Override @@ -511,7 +511,7 @@ /** * returns the scope blocks parent - * + * * @return the parent of this scope block */ public ScopeBlock getParent() { @@ -520,7 +520,7 @@ /** * returns the start of the block - * + * * @return the start of the block */ public int getStart() { @@ -529,7 +529,7 @@ /** * returns the end of the block - * + * * @return the end of the block */ public int getFinish() { @@ -538,7 +538,7 @@ /** * sets the start pc of the block - * + * * @param start * the start pc */ @@ -548,7 +548,7 @@ /** * sets the finish pc of the block - * + * * @param finish * the finish pc */ @@ -569,7 +569,7 @@ /** * returns whether this scope block is a loop - * + * * @returns whether this block is a loop */ public boolean isLoop() { @@ -585,7 +585,7 @@ /** * returns whether this block was caused from a goto - * + * * @returns whether this block was caused by a goto */ public boolean isGoto() { @@ -594,7 +594,7 @@ /** * adds the register as a store in this scope block - * + * * @param reg * the register that was stored * @param pc @@ -615,7 +615,7 @@ /** * removes stores to registers that where retrieved from method calls on * assocObject - * + * * @param assocObject * the object that a method call was just performed on */ @@ -635,7 +635,7 @@ /** * adds the register as a load in this scope block - * + * * @param reg * the register that was loaded * @param pc @@ -652,7 +652,7 @@ /** * adds a scope block to this subtree by finding the correct place in * the hierarchy to store it - * + * * @param newChild * the scope block to add to the tree */ @@ -684,7 +684,7 @@ /** * removes a child from this node - * + * * @param child * the child to remove */ @@ -760,10 +760,10 @@ /** * returns whether this block either loads or stores into the register * in question - * + * * @param reg * the register to look for loads or stores - * + * * @return whether the block uses the register */ public boolean usesReg(Integer reg) { @@ -823,7 +823,7 @@ return dangerousAssignmentMethodSources.contains(key); } - class UserObject { + static class UserObject { Comparable<?> caller; boolean isRisky; } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -87,7 +87,7 @@ /** * overrides the visitor to collect package and class names - * + * * @param classContext the context object that holds the JavaClass being parsed */ @Override @@ -106,7 +106,7 @@ /** * overrides the visitor to check whether the method is static - * + * * @param obj the method currently being parsed */ @Override @@ -118,7 +118,7 @@ /** * overrides the visitor to look for the method that uses another class the most, and * if it exceeds the threshold reports it - * + * * @param obj the code that is currently being parsed */ @Override @@ -147,11 +147,11 @@ if (bestEnvyCount < envyMin) { return; } - String bestEnvy = bestEnvyEntry.getKey(); double bestPercent = ((double)bestEnvyCount) / ((double) (bestEnvyCount + thisClsAccessCount)); if (bestPercent > envyPercent) { + String bestEnvy = bestEnvyEntry.getKey(); if (implementsCommonInterface(bestEnvy)) { return; } @@ -168,7 +168,7 @@ /** * overrides the visitor to look for method calls, and populate a class access count map * based on the owning class of methods called. - * + * * @param seen the opcode currently being parsed */ @Override @@ -204,9 +204,9 @@ /** * return whether or not a class implements a common or marker interface - * + * * @param name the class name to check - * + * * @return if this class implements a common or marker interface */ private boolean implementsCommonInterface(String name) { @@ -233,9 +233,9 @@ /** * increment the count of class access of the class on the stack - * + * * @param classAtStackIndex the position on the stack of the class in question - * + * * @return true if the class is counted */ private boolean countClassAccess(final int classAtStackIndex) { @@ -261,7 +261,7 @@ /** * increment the count of class access of the specified class if it is in a similar * package to the caller, and is not general purpose - * + * * @param calledClass the class to check */ private void countClassAccess(final String calledClass) { @@ -284,7 +284,7 @@ /** * add the current line number to a set of line numbers - * + * * @param lineNumbers the current set of line numbers */ private void addLineNumber(Set<Integer> lineNumbers) { @@ -303,9 +303,9 @@ /** * checks to see if the specified class is a built in class, or implements a simple interface - * + * * @param className the class in question - * + * * @return whether or not the class is general purpose */ private boolean generalPurpose(final String className) { Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CompareClassNameEquals.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -2,17 +2,17 @@ * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 Bhaskar Maddala * Copyright (C) 2005-2012 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 @@ -31,13 +31,13 @@ * In a JVM, Two classes are the same class (and consequently the same type) if * they are loaded by the same class loader, and they have the same fully * qualified name [JVMSpec 1999]. - * + * * Two classes with the same name but different package names are distinct, as * are two classes with the same fully qualified name loaded by different class * loaders. - * + * * Find usage involving comparison of class names, rather than the class itself. - * + * */ public class CompareClassNameEquals extends OpcodeStackDetector { private boolean flag = false; @@ -76,7 +76,7 @@ && "java/lang/String".equals(getClassConstantOperand())) { Item item = stack.getItemMethodInvokedOn(this); Object userValue = item.getUserValue(); - if (userValue != null && userValue == Boolean.TRUE) { + if (userValue != null && Boolean.TRUE.equals(userValue)) { bugReporter .reportBug(new BugInstance(this, "CCNE_COMPARE_CLASS_EQUALS_NAME", Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2012 Bhaskar Maddala - * + * * 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 @@ -33,18 +33,18 @@ import edu.umd.cs.findbugs.OpcodeStack; /** - * Finds contravariant array assignments. Since arrays are mutable data structures, their use + * Finds contravariant array assignments. Since arrays are mutable data structures, their use * must be restricted to covariant or invariant usage - * + * * <pre> * class A {} * class B extends A {} - * + * * B[] b = new B[2]; * A[] a = b; * a[0] = new A(); // results in ArrayStoreException (Runtime) * </pre> - * + * * Contravariant array assignments are reported as low or normal priority bugs. In cases * where the detector can determine an ArrayStoreException the bug is reported with high priority. * @@ -52,7 +52,7 @@ public class ContraVariantArrayAssignment extends BytecodeScanningDetector { private final BugReporter bugReporter; private final OpcodeStack stack; - + /** * constructs a CVAA detector given the reporter to report bugs on. @@ -65,9 +65,9 @@ /** * implements the visitor to pass through constructors and static initializers to the - * byte code scanning code. These methods are not reported, but are used to build + * byte code scanning code. These methods are not reported, but are used to build * SourceLineAnnotations for fields, if accessed. - * + * * @param obj the context object of the currently parsed code attribute */ @Override @@ -81,7 +81,7 @@ @Override public void sawOpcode(int seen) { - try{ + try{ switch(seen){ case ASTORE: case ASTORE_0: @@ -102,23 +102,24 @@ case PUTFIELD: case PUTSTATIC: if(stack.getStackDepth() > 0){ - OpcodeStack.Item item = stack.getStackItem(0); + OpcodeStack.Item item = stack.getStackItem(0); String sourceSignature = item.getSignature(); String targetSignature = getSigConstantOperand(); checkSignatures(sourceSignature, targetSignature); } break; case AASTORE: +/* OpcodeStack.Item arrayref = stack.getStackItem(2); OpcodeStack.Item value = stack.getStackItem(0); - + if(!value.isNull()) { - String sourceSignature = value.getSignature(); + String sourceSignature = value.getSignature(); String targetSignature = arrayref.getSignature(); if (!"Ljava/lang/Object;".equals(targetSignature)) { try{ if(Type.getType(sourceSignature) instanceof ObjectType ) { - ObjectType sourceType = (ObjectType) Type.getType(sourceSignature); + ObjectType sourceType = (ObjectType) Type.getType(sourceSignature); ObjectType targetType = (ObjectType) ((ArrayType) Type.getType(targetSignature)).getBasicType(); if(!sourceType.equals(targetType) && !sourceType.subclassOf(targetType)){ bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", HIGH_PRIORITY) @@ -132,6 +133,7 @@ } } } +*/ break; } super.sawOpcode(seen); @@ -140,11 +142,11 @@ stack.sawOpcode(this, seen); } } - + private boolean isArrayType(String signature){ return Type.getType(signature) instanceof ArrayType; } - + private boolean isObjectType(String signature){ return ((ArrayType)Type.getType(signature)).getBasicType() instanceof ObjectType; } @@ -154,7 +156,7 @@ if ("Ljava/lang/Object;".equals(targetSignature)) { return; } - + if(isArrayType(sourceSignature) && isArrayType(targetSignature)) { if(isObjectType(sourceSignature) && isObjectType(targetSignature)) { ObjectType sourceType = (ObjectType) ((ArrayType) Type.getType(sourceSignature)).getBasicType(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DeletingWhileIterating.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -32,6 +32,7 @@ import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.LocalVariable; import org.apache.bcel.classfile.LocalVariableTable; +import org.apache.bcel.generic.Type; import com.mebigfatguy.fbcontrib.utils.CodeByteUtils; import com.mebigfatguy.fbcontrib.utils.RegisterUtils; @@ -52,8 +53,8 @@ * this occurs the iterator will become invalid and throw a ConcurrentModificationException. * Instead, the remove should be called on the iterator itself. */ -public class DeletingWhileIterating extends BytecodeScanningDetector -{ +public class DeletingWhileIterating extends BytecodeScanningDetector +{ private static JavaClass collectionClass; private static JavaClass iteratorClass; private static Set<JavaClass> exceptionClasses; @@ -66,14 +67,14 @@ collectionClass = null; iteratorClass = null; } - + try { exceptionClasses = new HashSet<JavaClass>(); exceptionClasses.add(Repository.lookupClass("java.util.concurrent.CopyOnWriteArrayList")); exceptionClasses.add(Repository.lookupClass("java.util.concurrent.CopyOnWriteArraySet")); } catch (ClassNotFoundException cnfe) { } - + collectionMethods = new HashSet<String>(); collectionMethods.add("entrySet()Ljava/lang/Set;"); collectionMethods.add("keySet()Ljava/lang/Set;"); @@ -96,7 +97,7 @@ private Map<Integer, Integer> groupToIterator; private Map<Integer, Loop> loops; private Map<Integer, Set<Integer>> endOfScopes; - + /** * constructs a DWI detector given the reporter to report bugs on * @param bugReporter the sync of bug reports @@ -104,18 +105,18 @@ public DeletingWhileIterating(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** * implements the visitor to setup the opcode stack, collectionGroups, groupToIterator and loops - * + * * @param classContext the context object of the currently parsed class */ @Override public void visitClassContext(ClassContext classContext) { if ((collectionClass == null) || (iteratorClass == null)) return; - - try { + + try { stack = new OpcodeStack(); collectionGroups = new ArrayList<Set<Comparable<?>>>(); groupToIterator = new HashMap<Integer, Integer>(); @@ -129,10 +130,10 @@ endOfScopes = null; } } - + /** * implements the visitor to reset the stack, collectionGroups, groupToIterator and loops - * + * * @param obj the context object of the currently parsed code block */ @Override @@ -142,19 +143,19 @@ groupToIterator.clear(); loops.clear(); buildVariableEndScopeMap(); - + super.visitCode(obj); } - + /** * implements the visitor to look for deletes on collections that are being iterated - * + * * @param seen the opcode of the currently parsed instruction */ @Override public void sawOpcode(int seen) { int groupId = -1; - + try { if (seen == INVOKEINTERFACE) { @@ -162,13 +163,13 @@ String methodName = getNameConstantOperand(); String signature = getSigConstantOperand(); String methodInfo = methodName + signature; - + if (isCollection(className)) { if (collectionMethods.contains(methodInfo)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); groupId = findCollectionGroup(itm, true); - + } } else if ("iterator()Ljava/util/Iterator;".equals(methodInfo)) { if (stack.getStackDepth() > 0) { @@ -185,19 +186,8 @@ if (loop != null) { int pc = getPC(); if (loop.hasPC(pc)) { - boolean breakFollows = false; - byte[] code = getCode().getCode(); - int nextPC = getNextPC(); - int popOp = CodeByteUtils.getbyte(code, nextPC++); - if (popOp == Constants.POP) { - int gotoOp = CodeByteUtils.getbyte(code, nextPC); - if (gotoOp == Constants.GOTO) { - int target = nextPC + CodeByteUtils.getshort(code, nextPC+1); - if (target > loop.getLoopFinish()) - breakFollows = true; - } - } - + boolean breakFollows = breakFollows(loop, !Type.getReturnType(signature).getSignature().equals("V")); + if (!breakFollows) { bugReporter.reportBug(new BugInstance(this, "DWI_DELETING_WHILE_ITERATING", NORMAL_PRIORITY) .addClass(this) @@ -221,10 +211,13 @@ if (loop != null) { int pc = getPC(); if (loop.hasPC(pc)) { - bugReporter.reportBug(new BugInstance(this, "DWI_MODIFYING_WHILE_ITERATING", NORMAL_PRIORITY) + boolean breakFollows = breakFollows(loop, !Type.getReturnType(signature).getSignature().equals("V")); + if (!breakFollows) { + bugReporter.reportBug(new BugInstance(this, "DWI_MODIFYING_WHILE_ITERATING", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); + } } } } @@ -243,7 +236,7 @@ } else if (seen == PUTFIELD) { if (stack.getStackDepth() > 1) { OpcodeStack.Item itm = stack.getStackItem(0); - + Integer id = (Integer)itm.getUserValue(); if (id == null) { FieldAnnotation fa = FieldAnnotation.fromFieldDescriptor(new FieldDescriptor(getClassConstantOperand(), getNameConstantOperand(), getSigConstantOperand(), false)); @@ -257,7 +250,7 @@ Integer id = (Integer)itm.getUserValue(); if (id != null) { int reg = RegisterUtils.getAStoreReg(this, seen); - + try { JavaClass cls = itm.getJavaClass(); if ((cls != null) && cls.implementationOf(iteratorClass)) { @@ -269,7 +262,7 @@ } groupToIterator.put(id, regIt); } - + Set<Comparable<?>> group = collectionGroups.get(id.intValue()); if (group != null) { group.add(Integer.valueOf(reg)); @@ -309,11 +302,33 @@ OpcodeStack.Item itm = stack.getStackItem(0); itm.setUserValue(Integer.valueOf(groupId)); } - + processEndOfScopes(Integer.valueOf(getPC())); } } - + + private boolean breakFollows(Loop loop, boolean needsPop) { + + byte[] code = getCode().getCode(); + int nextPC = getNextPC(); + + if (needsPop) { + int popOp = CodeByteUtils.getbyte(code, nextPC++); + if (popOp != Constants.POP) { + return false; + } + } + + int gotoOp = CodeByteUtils.getbyte(code, nextPC); + if ((gotoOp == Constants.GOTO) || (gotoOp == Constants.GOTO_W)) { + int target = nextPC + CodeByteUtils.getshort(code, nextPC+1); + if (target > loop.getLoopFinish()) + return true; + } + + return false; + } + private boolean isCollection(String className) { try { JavaClass cls = Repository.lookupClass(className); @@ -323,10 +338,10 @@ return false; } } - + private Comparable<?> getGroupElement(OpcodeStack.Item itm) { Comparable<?> groupElement = null; - + int reg = itm.getRegisterNumber(); if (reg >= 0) groupElement = Integer.valueOf(reg); @@ -338,10 +353,10 @@ groupElement = field.getName() + ":{" + regLoad + "}"; } } - + return groupElement; } - + private int findCollectionGroup(OpcodeStack.Item itm, boolean addIfNotFound) { Integer id = (Integer)itm.getUserValue(); @@ -357,7 +372,7 @@ return i; } } - + if (addIfNotFound) { Set<Comparable<?>> group = new HashSet<Comparable<?>>(); group.add(groupElement); @@ -365,10 +380,10 @@ return collectionGroups.size() - 1; } } - + return -1; } - + private void removeFromCollectionGroup(OpcodeStack.Item itm) { Comparable<?> groupElement = getGroupElement(itm); if (groupElement != null) { @@ -380,10 +395,10 @@ } } } - + private void buildVariableEndScopeMap() { endOfScopes = new HashMap<Integer, Set<Integer>>(); - + LocalVariableTable lvt = getMethod().getLocalVariableTable(); if (lvt != null) { int len = lvt.getLength(); @@ -402,7 +417,7 @@ } } } - + private void processEndOfScopes(Integer pc) { Set<Integer> endVars = endOfScopes.get(pc); if (endVars != null) { @@ -417,12 +432,12 @@ } } } - + static class Loop { public int loopStart; public int loopFinish; - + public Loop(int start, int finish) { loopStart = start; loopFinish = finish; @@ -435,11 +450,11 @@ public int getLoopStart() { return loopStart; } - + public boolean hasPC(int pc) { return (loopStart <= pc) && (pc <= loopFinish); } - + @Override public String toString() { return "Start=" + loopStart + " Finish=" + loopFinish; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/FieldCouldBeLocal.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -66,18 +66,18 @@ * constructs a FCBL detector given the reporter to report bugs on. * @param bugReporter the sync of bug reports - */ + */ public FieldCouldBeLocal(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** * overrides the visitor to collect localizable fields, and then report those that * survive all method checks. - * + * * @param classContext the context object that holds the JavaClass parsed */ - @Override + @Override public void visitClassContext(ClassContext classContext) { try { localizableFields = new HashMap<String, FieldInfo>(); @@ -91,7 +91,7 @@ localizableFields.put(f.getName(), new FieldInfo(fa)); } } - + if (localizableFields.size() > 0) { super.visitClassContext(classContext); for (FieldInfo fi : localizableFields.values()) { @@ -111,26 +111,23 @@ clsContext = null; } } - + /** * overrides the visitor to navigate basic blocks looking for all first usages of fields, removing * those that are read from first. - * + * * @param obj the context object of the currently parsed method */ @Override public void visitMethod(Method obj) { if (localizableFields.isEmpty()) return; - - String methodName = obj.getName(); - if ("<clinit>".equals(methodName) || "<init>".equals(methodName)) - return; + try { cpg = new ConstantPoolGen(getConstantPool()); cfg = clsContext.getCFG(obj); BasicBlock bb = cfg.getEntry(); - Set<String> uncheckedFields = new HashSet<String>(localizableFields.keySet()); + Set<String> uncheckedFields = new HashSet<String>(localizableFields.keySet()); visitedBlocks.clear(); checkBlock(bb, uncheckedFields); } @@ -142,10 +139,10 @@ cpg = null; } } - + /** * looks for methods that contain a GETFIELD or PUTFIELD opcodes - * + * * @param method the context object of the current method * @return if the class uses synchronization */ @@ -153,12 +150,12 @@ BitSet bytecodeSet = getClassContext().getBytecodeSet(method); return (bytecodeSet != null) && (bytecodeSet.get(Constants.PUTFIELD) || bytecodeSet.get(Constants.GETFIELD)); } - + /** * implements the visitor to pass through constructors and static initializers to the - * byte code scanning code. These methods are not reported, but are used to build + * byte code scanning code. These methods are not reported, but are used to build * SourceLineAnnotations for fields, if accessed. - * + * * @param obj the context object of the currently parsed code attribute */ @Override @@ -170,11 +167,11 @@ super.visitCode(obj); } } - + /** * implements the visitor to add SourceLineAnnotations for fields in constructors and static * initializers. - * + * * @param seen the opcode of the currently visited instruction */ @Override @@ -188,13 +185,13 @@ } } } - + /** * looks in this basic block for the first access to the fields in uncheckedFields. Once found - * the item is removed from uncheckedFields, and removed from localizableFields if the access is + * the item is removed from uncheckedFields, and removed from localizableFields if the access is * a GETFIELD. If any unchecked fields remain, this method is recursively called on all outgoing edges * of this basic block. - * + * * @param bb this basic block * @param uncheckedFields the list of fields to look for */ @@ -208,7 +205,7 @@ return; BlockState bState = toBeProcessed.removeFirst(); bb = bState.getBasicBlock(); - + InstructionIterator ii = bb.instructionIterator(); while ((bState.getUncheckedFieldSize() > 0) && ii.hasNext()) { InstructionHandle ih = ii.next(); @@ -217,7 +214,7 @@ FieldInstruction fi = (FieldInstruction) ins; String fieldName = fi.getFieldName(cpg); boolean justRemoved = bState.removeUncheckedField(fieldName); - + if (ins instanceof GETFIELD) { if (justRemoved) { localizableFields.remove(fieldName); @@ -229,9 +226,9 @@ if (finfo != null) finfo.setSrcLineAnnotation(SourceLineAnnotation.fromVisitedInstruction(clsContext, this, ih.getPosition())); } - } + } } - + if (bState.getUncheckedFieldSize() > 0) { Iterator<Edge> oei = cfg.outgoingEdgeIterator(bb); while (oei.hasNext()) { @@ -246,14 +243,14 @@ } } } - + /** * holds information about a field and it's first usage */ private static class FieldInfo { private final FieldAnnotation fieldAnnotation; private SourceLineAnnotation srcLineAnnotation; - + /** * creates a FieldInfo from an annotation, and assumes no source line information * @param fa the field annotation for this field @@ -262,7 +259,7 @@ fieldAnnotation = fa; srcLineAnnotation = null; } - + /** * set the source line annotation of first use for this field * @param sla the source line annotation @@ -271,7 +268,7 @@ if (srcLineAnnotation == null) srcLineAnnotation = sla; } - + /** * get the field annotation for this field * @return the field annotation @@ -279,7 +276,7 @@ public FieldAnnotation getFieldAnnotation() { return fieldAnnotation; } - + /** * get the source line annotation for the first use of this field * @return the source line annotation @@ -288,10 +285,10 @@ return srcLineAnnotation; } } - + /** * holds the parse state of the current basic block, and what fields are left to be checked - * the fields that are left to be checked are a reference from the parent block + * the fields that are left to be checked are a reference from the parent block * and a new collection is created on first write to the set to reduce memory concerns. */ private static class BlockState { @@ -300,7 +297,7 @@ private boolean fieldsAreSharedWithParent; /** - * creates a BlockState consisting of the next basic block to parse, + * creates a BlockState consisting of the next basic block to parse, * and what fields are to be checked * @param bb the basic block to parse * @param fields the fields to look for first use @@ -310,9 +307,9 @@ uncheckedFields = fields; fieldsAreSharedWithParent = true; } - + /** - * creates a BlockState consisting of the next basic block to parse, + * creates a BlockState consisting of the next basic block to parse, * and what fields are to be checked * @param bb the basic block to parse * @param the basic block to copy from @@ -322,7 +319,7 @@ uncheckedFields = parentBlockState.uncheckedFields; fieldsAreSharedWithParent = true; } - + /** * get the basic block to parse * @return the basic block @@ -330,7 +327,7 @@ public BasicBlock getBasicBlock() { return basicBlock; } - + /** * returns the number of unchecked fields * @return the number of unchecked fields @@ -338,7 +335,7 @@ public int getUncheckedFieldSize() { return (uncheckedFields == null) ? 0 : uncheckedFields.size(); } - + /** * return the field from the set of unchecked fields * if this occurs make a copy of the set on write to reduce memory usage @@ -351,7 +348,7 @@ fieldsAreSharedWithParent = false; return true; } - + if (fieldsAreSharedWithParent) { uncheckedFields = new HashSet<String>(uncheckedFields); fieldsAreSharedWithParent = false; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossibleConstantAllocationInLoop.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -34,7 +34,7 @@ import edu.umd.cs.findbugs.ba.ClassContext; public class PossibleConstantAllocationInLoop extends BytecodeScanningDetector { - + private final BugReporter bugReporter; private OpcodeStack stack; /** allocation number, info where allocated */ @@ -42,11 +42,11 @@ /** reg, allocation number */ private Map<Integer, Integer> storedAllocations; private int nextAllocationNumber; - + public PossibleConstantAllocationInLoop(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + @Override public void visitClassContext(ClassContext classContext) { try { @@ -60,7 +60,7 @@ storedAllocations = null; } } - + @Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); @@ -68,7 +68,7 @@ storedAllocations.clear(); nextAllocationNumber = 1; super.visitCode(obj); - + for (AllocationInfo info : allocations.values()) { if (info.loopBottom != -1) { bugReporter.reportBug(new BugInstance(this, "PCAIL_POSSIBLE_CONSTANT_ALLOCATION_IN_LOOP", NORMAL_PRIORITY) @@ -78,12 +78,12 @@ } } } - + @Override public void sawOpcode(int seen) { boolean sawAllocation = false; Integer sawAllocationNumber = null; - + try { switch (seen) { case IFEQ: @@ -115,7 +115,7 @@ } } break; - + case INVOKESPECIAL: if ("<init>".equals(getNameConstantOperand()) && "()V".equals(getSigConstantOperand())) { String clsName = getClassConstantOperand(); @@ -126,11 +126,12 @@ } } //$FALL-THROUGH$ - + case INVOKEINTERFACE: case INVOKEVIRTUAL: case INVOKESTATIC: - Type[] types = Type.getArgumentTypes(getSigConstantOperand()); + String signature = getSigConstantOperand(); + Type[] types = Type.getArgumentTypes(signature); if (stack.getStackDepth() >= types.length) { for (int i = 0; i < types.length; i++) { OpcodeStack.Item item = stack.getStackItem(i); @@ -139,9 +140,21 @@ allocations.remove(allocation); } } + if ((seen == INVOKEINTERFACE) || (seen == INVOKEVIRTUAL) || ((seen == INVOKESPECIAL))) { + //ignore possible method chaining + OpcodeStack.Item item = stack.getStackItem(types.length); + Integer allocation = (Integer)item.getUserValue(); + if (allocation != null) { + String retType = Type.getReturnType(signature).getSignature(); + if (!"V".equals(retType) && retType.equals(item.getSignature())) { + sawAllocationNumber = allocation; + sawAllocation = true; + } + } + } } break; - + case ASTORE: case ASTORE_0: case ASTORE_1: @@ -151,9 +164,9 @@ OpcodeStack.Item item = stack.getStackItem(0); Integer allocation = (Integer)item.getUserValue(); if (allocation != null) { - Integer reg = Integer.valueOf(RegisterUtils.getAStoreReg(this, seen)); + Integer reg = Integer.valueOf(RegisterUtils.getAStoreReg(this, seen)); if (storedAllocations.values().contains(allocation)) { - allocations.remove(allocation); + allocations.remove(allocation); storedAllocations.remove(reg); } else if (storedAllocations.containsKey(reg)) { allocations.remove(allocation); @@ -165,7 +178,7 @@ } } break; - + case AASTORE: if (stack.getStackDepth() >= 2) { OpcodeStack.Item item = stack.getStackItem(0); @@ -175,7 +188,7 @@ } } break; - + case ALOAD: case ALOAD_0: case ALOAD_1: @@ -195,7 +208,7 @@ } } break; - + case PUTFIELD: if (stack.getStackDepth() > 1) { OpcodeStack.Item item = stack.getStackItem(0); @@ -203,7 +216,7 @@ allocations.remove(allocation); } break; - + case ARETURN: case ATHROW: if (stack.getStackDepth() > 0) { @@ -212,7 +225,7 @@ if (allocation != null) { allocations.remove(allocation); } - } + } break; } } finally { @@ -224,19 +237,19 @@ OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(sawAllocationNumber); } - + if (seen == INVOKESPECIAL) nextAllocationNumber++; } } } - + static class AllocationInfo { - + int allocationPC; int loopTop; int loopBottom; - + public AllocationInfo(int pc) { allocationPC = pc; loopTop = -1; Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PossiblyRedundantMethodCalls.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -199,8 +199,6 @@ } else if (seen == PUTFIELD) { fieldMethodCalls.remove(getNameConstantOperand()); } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE) || (seen == INVOKESTATIC)) { - String className = getClassConstantOperand(); - String methodName = getNameConstantOperand(); String signature = getSigConstantOperand(); int parmCount = Type.getArgumentTypes(signature).length; int neededStackSize = parmCount - ((seen == INVOKESTATIC) ? 1 : 0); @@ -214,6 +212,7 @@ } } + String className = getClassConstantOperand(); MethodCall mc; int reg = -1; @@ -236,6 +235,7 @@ } } + String methodName = getNameConstantOperand(); if (mc != null) { if (!signature.endsWith("V") && methodName.equals(mc.getName()) && signature.equals(mc.getSignature()) && !isRiskyName(className, methodName)) { Object[] parms = mc.getParms(); Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2012-10-25 19:46:23 UTC (rev 1728) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpoiledChildInterfaceImplementor.java 2012-10-31 17:32:54 UTC (rev 1729) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -31,31 +31,31 @@ import edu.umd.cs.findbugs.ba.ClassContext; /** - * looks for classes that implement interfaces by relying on methods being + * looks for classes that implement interfaces by relying on methods being * implemented in super classes, even though the superclass knows nothing about * the interface being implemented by the child. */ public class SpoiledChildInterfaceImplementor implements Detector { private final BugReporter bugReporter; - + /** * constructs a SCII detector given the reporter to report bugs on * @param bugReporter the sync of bug reports - */ + */ public SpoiledChildInterfaceImplementor(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** looks for classes that implement interfaces but don't provide those methods - * + * * @param classContext the context object of the currently parsed class */ public void visitClassC... [truncated message content] |
From: <dbr...@us...> - 2012-10-25 19:46:30
|
Revision: 1728 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1728&view=rev Author: dbrosius Date: 2012-10-25 19:46:23 +0000 (Thu, 25 Oct 2012) Log Message: ----------- tag 4.8.1 Added Paths: ----------- tags/v4_8_1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-25 19:45:30
|
Revision: 1727 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1727&view=rev Author: dbrosius Date: 2012-10-25 19:45:23 +0000 (Thu, 25 Oct 2012) Log Message: ----------- remove 4.8.1 Removed Paths: ------------- tags/v4_8_1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-25 19:42:13
|
Revision: 1726 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1726&view=rev Author: dbrosius Date: 2012-10-25 19:42:06 +0000 (Thu, 25 Oct 2012) Log Message: ----------- sync from git Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-10-25 14:38:17 UTC (rev 1725) +++ trunk/fb-contrib/build.xml 2012-10-25 19:42:06 UTC (rev 1726) @@ -17,7 +17,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="4.9.0" /> + <property name="fb-contrib.version" value="4.8.1" /> <property name="findbugs.version" value="2.0.0" /> <property name="findbugs-bcel.version" value="2.0.0" /> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:38:17 UTC (rev 1725) +++ trunk/fb-contrib/etc/findbugs.xml 2012-10-25 19:42:06 UTC (rev 1726) @@ -30,9 +30,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" /> <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" /> @@ -73,9 +73,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> @@ -176,9 +176,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> @@ -193,9 +193,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" /> <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> @@ -221,9 +221,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-25 14:38:24
|
Revision: 1725 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1725&view=rev Author: dbrosius Date: 2012-10-25 14:38:17 +0000 (Thu, 25 Oct 2012) Log Message: ----------- sync with git Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/htdocs/index.shtml trunk/fb-contrib/htdocs/repository.html Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-10-25 14:18:50 UTC (rev 1724) +++ trunk/fb-contrib/build.xml 2012-10-25 14:38:17 UTC (rev 1725) @@ -17,7 +17,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="4.8.1" /> + <property name="fb-contrib.version" value="4.9.0" /> <property name="findbugs.version" value="2.0.0" /> <property name="findbugs-bcel.version" value="2.0.0" /> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:18:50 UTC (rev 1724) +++ trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:38:17 UTC (rev 1725) @@ -30,9 +30,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" /> <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" /> @@ -73,9 +73,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> @@ -176,9 +176,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> @@ -193,9 +193,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" /> <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> @@ -221,9 +221,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" /> -<!-- COMMENT OUT FOR RELEASE +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" /> - COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2012-10-25 14:18:50 UTC (rev 1724) +++ trunk/fb-contrib/htdocs/index.shtml 2012-10-25 14:38:17 UTC (rev 1725) @@ -68,8 +68,8 @@ </li> </ul> </p> - <p style="font-weight: bold;">The latest version of fb-contrib is 4.6.1 available for download - <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.6.1.jar/download">here</a>.</p> + <p style="font-weight: bold;">The latest version of fb-contrib is 4.8.1 available for download + <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.8.1.jar/download">here</a>.</p> </div> <hr/> Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2012-10-25 14:18:50 UTC (rev 1724) +++ trunk/fb-contrib/htdocs/repository.html 2012-10-25 14:38:17 UTC (rev 1725) @@ -22,7 +22,7 @@ <table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;"> <tr><td><b>GroupId:</b></td><td>com.mebigfatguy</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>4.8.0</td></tr> + <tr><td><b>Version:</b></td><td>4.8.1</td></tr> </table> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-25 14:19:00
|
Revision: 1724 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1724&view=rev Author: dbrosius Date: 2012-10-25 14:18:50 +0000 (Thu, 25 Oct 2012) Log Message: ----------- prepare for 4.8.1 Added Paths: ----------- tags/v4_8_1/trunk/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-25 14:16:38
|
Revision: 1723 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1723&view=rev Author: dbrosius Date: 2012-10-25 14:16:26 +0000 (Thu, 25 Oct 2012) Log Message: ----------- pull from git Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-10-25 14:14:34 UTC (rev 1722) +++ trunk/fb-contrib/build.xml 2012-10-25 14:16:26 UTC (rev 1723) @@ -17,7 +17,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="4.9.0" /> + <property name="fb-contrib.version" value="4.8.1" /> <property name="findbugs.version" value="2.0.0" /> <property name="findbugs-bcel.version" value="2.0.0" /> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:14:34 UTC (rev 1722) +++ trunk/fb-contrib/etc/findbugs.xml 2012-10-25 14:16:26 UTC (rev 1723) @@ -30,9 +30,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" /> <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" /> @@ -73,9 +73,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> @@ -176,9 +176,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> @@ -193,9 +193,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" /> <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> @@ -221,9 +221,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" /> -<!-- COMMENT OUT FOR RELEASE --> +<!-- COMMENT OUT FOR RELEASE <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" /> -<!-- COMMENT OUT FOR RELEASE --> + COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-25 14:14:43
|
Revision: 1722 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1722&view=rev Author: dbrosius Date: 2012-10-25 14:14:34 +0000 (Thu, 25 Oct 2012) Log Message: ----------- tag v4.8.1 Added Paths: ----------- tags/v4_8_1/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-25 14:11:15
|
Revision: 1721 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1721&view=rev Author: dbrosius Date: 2012-10-25 14:11:03 +0000 (Thu, 25 Oct 2012) Log Message: ----------- uptake from git Modified Paths: -------------- trunk/fb-contrib/samples/LEST_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java Modified: trunk/fb-contrib/samples/LEST_Sample.java =================================================================== --- trunk/fb-contrib/samples/LEST_Sample.java 2012-10-20 02:17:27 UTC (rev 1720) +++ trunk/fb-contrib/samples/LEST_Sample.java 2012-10-25 14:11:03 UTC (rev 1721) @@ -127,6 +127,18 @@ } } + public void testLestFP8() + { + try + { + Thread.sleep(10L); + } + catch (Exception ex) + { + throw new AssertionError(ex); + } + } + private Exception wrap(Exception e) { return new Exception(e); } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-10-20 02:17:27 UTC (rev 1720) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-10-25 14:11:03 UTC (rev 1721) @@ -55,10 +55,13 @@ { private static JavaClass errorClass; private static JavaClass throwableClass; + private static JavaClass assertionClass; + static { try { errorClass = Repository.lookupClass("java/lang/Error"); throwableClass = Repository.lookupClass("java/lang/Throwable"); + assertionClass = Repository.lookupClass("java/lang/AssertionError"); } catch (ClassNotFoundException cnfe) { errorClass = null; throwableClass = null; @@ -215,6 +218,11 @@ markAsValid = true; break; } + if (exClass.instanceOf(assertionClass)) { + //just ignore LEST for AssertionErrors + markAsValid = true; + break; + } } } else if (isPossibleExBuilder(catchInfo.getRegister())) { markAsValid = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-20 02:17:35
|
Revision: 1720 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1720&view=rev Author: dbrosius Date: 2012-10-20 02:17:27 +0000 (Sat, 20 Oct 2012) Log Message: ----------- sync from git Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/htdocs/repository.html trunk/fb-contrib/samples/LEST_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-10-19 22:23:05 UTC (rev 1719) +++ trunk/fb-contrib/build.xml 2012-10-20 02:17:27 UTC (rev 1720) @@ -17,7 +17,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="4.8.0" /> + <property name="fb-contrib.version" value="4.9.0" /> <property name="findbugs.version" value="2.0.0" /> <property name="findbugs-bcel.version" value="2.0.0" /> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2012-10-19 22:23:05 UTC (rev 1719) +++ trunk/fb-contrib/etc/findbugs.xml 2012-10-20 02:17:27 UTC (rev 1720) @@ -30,9 +30,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedCollectionContents" speed="fast" reports="UCC_UNRELATED_COLLECTION_CONTENTS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeclaredRuntimeException" speed="fast" reports="DRE_DECLARED_RUNTIME_EXCEPTION" /> -<!-- +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" speed="fast" reports="CE_CLASS_ENVY" disabled="true" /> ---> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.LiteralStringComparison" speed="fast" reports="LSC_LITERAL_STRING_COMPARISON" /> <Detector class="com.mebigfatguy.fbcontrib.detect.PartiallyConstructedObjectAccess" speed="fast" reports="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" /> @@ -73,9 +73,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractOverriddenMethod" speed="fast" reports="AOM_ABSTRACT_OVERRIDDEN_METHOD" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CustomBuiltXML" speed="fast" reports="CBX_CUSTOM_BUILT_XML" /> -<!-- +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> ---> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" speed="fast" reports="CLI_CONSTANT_LIST_INDEX" /> <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> @@ -176,9 +176,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryNewNullCheck" speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> <Detector class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> -<!-- +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> ---> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> @@ -193,9 +193,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" /> <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> -<!-- +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" hidden="true" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT,CVAA_CONTRAVARIANT_ELEMENT_ASSIGNMENT" /> ---> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> @@ -221,9 +221,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" /> -<!-- +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" /> - --> +<!-- COMMENT OUT FOR RELEASE --> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> Modified: trunk/fb-contrib/htdocs/repository.html =================================================================== --- trunk/fb-contrib/htdocs/repository.html 2012-10-19 22:23:05 UTC (rev 1719) +++ trunk/fb-contrib/htdocs/repository.html 2012-10-20 02:17:27 UTC (rev 1720) @@ -22,7 +22,7 @@ <table style="margin-left: 40px; background-color: #A0A0FF; padding: 20px; border-width: 1px; border-style: outset; border-color: #000000;"> <tr><td><b>GroupId:</b></td><td>com.mebigfatguy</td></tr> <tr><td><b>ArtifactId:</b></td><td>fb-contrib</td></tr> - <tr><td><b>Version:</b></td><td>4.6.1</td></tr> + <tr><td><b>Version:</b></td><td>4.8.0</td></tr> </table> </div> Modified: trunk/fb-contrib/samples/LEST_Sample.java =================================================================== --- trunk/fb-contrib/samples/LEST_Sample.java 2012-10-19 22:23:05 UTC (rev 1719) +++ trunk/fb-contrib/samples/LEST_Sample.java 2012-10-20 02:17:27 UTC (rev 1720) @@ -4,7 +4,7 @@ import java.util.Date; @SuppressWarnings("all") -public class LEST_Sample +public class LEST_Sample { public Date testLest1(String input) { @@ -12,33 +12,33 @@ { DateFormat df = new SimpleDateFormat("YYYY"); return df.parse(input); - } + } catch (ParseException pe) { throw new IllegalArgumentException(pe.getMessage()); } } - + public Date testLest2(String input) { try { DateFormat df = new SimpleDateFormat("YYYY"); return df.parse(input); - } + } catch (ParseException pe) { throw new IllegalArgumentException(pe.getMessage(), pe); } } - + public Date testLestFP1(String input) throws ParseException { try { DateFormat df = new SimpleDateFormat("YYYY"); return df.parse(input); - } + } catch (ParseException pe) { throw pe; @@ -51,7 +51,7 @@ { DateFormat df = new SimpleDateFormat("YYYY"); return df.parse(input); - } + } catch (ParseException pe) { IllegalArgumentException iae = new IllegalArgumentException(pe.getMessage()); @@ -59,7 +59,7 @@ throw iae; } } - + public void testLestFP3(String s) { double d; @@ -69,11 +69,11 @@ } catch (NumberFormatException nfe) { - + } throw new RuntimeException("ok"); } - + public void testLestFP4(String s) throws Exception { double d; @@ -87,7 +87,7 @@ throw e; } } - + public void testLestFP5(String s) throws Exception { double d; @@ -101,7 +101,7 @@ throw e; } } - + public void testLestFP6(String s) throws Exception { double d; @@ -114,11 +114,23 @@ throw new Exception("Yikes"); } } - + + public void testLestFP7(String s) + { + try + { + double d = Double.parseDouble(s); + } + catch (NumberFormatException e) + { + throw new RuntimeException(e); + } + } + private Exception wrap(Exception e) { return new Exception(e); } - + private static Exception wrapStatic(Exception e) { return new Exception(e); } Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-10-19 22:23:05 UTC (rev 1719) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2012-10-20 02:17:27 UTC (rev 1720) @@ -1,17 +1,17 @@ /* * fb-contrib - Auxiliary detectors for Java programs * Copyright (C) 2005-2012 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 @@ -51,42 +51,45 @@ * the original exception within it. Doing this loses the stack history, and where the original * problem occurred. This makes finding and fixing errors difficult. */ -public class LostExceptionStackTrace extends BytecodeScanningDetector +public class LostExceptionStackTrace extends BytecodeScanningDetector { - private static JavaClass throwableClass; + private static JavaClass errorClass; + private static JavaClass throwableClass; static { try { - throwableClass = Repository.lookupClass("java/lang/Throwable"); + errorClass = Repository.lookupClass("java/lang/Error"); + throwableClass = Repository.lookupClass("java/lang/Throwable"); } catch (ClassNotFoundException cnfe) { - throwableClass = null; + errorClass = null; + throwableClass = null; } } - + private final BugReporter bugReporter; private OpcodeStack stack; private CodeException[] exceptions; private Set<CatchInfo> catchInfos; private Map<Integer, Boolean> exReg; private boolean lastWasExitPoint = false; - + /** * constructs a LEST detector given the reporter to report bugs on * @param bugReporter the sync of bug reports - */ + */ public LostExceptionStackTrace(BugReporter bugReporter) { this.bugReporter = bugReporter; } - + /** * implements the visitor to make sure the jdk is 1.4 or better - * + * * @param classContext the context object of the currently parsed class */ @Override public void visitClassContext(ClassContext classContext) { try { - if (throwableClass != null && !isPre14Class(classContext.getJavaClass())) { + if (errorClass != null && throwableClass != null && !isPre14Class(classContext.getJavaClass())) { stack = new OpcodeStack(); catchInfos = new HashSet<CatchInfo>(); exReg = new HashMap<Integer, Boolean>(); @@ -99,10 +102,10 @@ exReg = null; } } - + /** * looks for methods that contain a catch block and an ATHROW opcode - * + * * @param code the context object of the current code block * @param method the context object of the current method * @return if the class throws exceptions @@ -112,7 +115,7 @@ { return false; } - + CodeException[] ce = code.getExceptionTable(); if (ce == null || ce.length == 0) { @@ -125,7 +128,7 @@ /** * implements the visitor to filter out methods that don't throw exceptions - * + * * @param obj the context object of the currently parsed code block */ @Override @@ -139,10 +142,10 @@ super.visitCode(obj); } } - + /** * collects all the valid exception objects (ones where start and finish are before the target - * + * * @param exs the exceptions from the class file * @return the filtered exceptions */ @@ -155,7 +158,7 @@ } return filteredEx.toArray(new CodeException[filteredEx.size()]); } - + /** * implements the visitor to find throwing alternative exceptions from a catch block, without * forwarding along the original exception @@ -163,7 +166,7 @@ @Override public void sawOpcode(int seen) { boolean markAsValid = false; - + try { stack.mergeJumps(this); int pc = getPC(); @@ -185,7 +188,7 @@ removePreviousHandlers(pc); } } - + Iterator<CatchInfo> it = catchInfos.iterator(); while (it.hasNext()) { try { @@ -204,10 +207,11 @@ if ("<init>".equals(getNameConstantOperand())) { String className = getClassConstantOperand(); JavaClass exClass = Repository.lookupClass(className); - if (exClass.instanceOf(throwableClass)) { + if (exClass.instanceOf(errorClass) || (exClass.instanceOf(throwableClass))) { String sig = getSigConstantOperand(); if (sig.indexOf("Exception") >= 0 - || sig.indexOf("Throwable") >= 0) { + || sig.indexOf("Throwable") >= 0 + || sig.indexOf("Error") >= 0) { markAsValid = true; break; } @@ -219,7 +223,7 @@ if ("initCause".equals(getNameConstantOperand())) { String className = getClassConstantOperand(); JavaClass exClass = Repository.lookupClass(className); - if (exClass.instanceOf(throwableClass)) { + if (exClass.instanceOf(errorClass)) { if (stack.getStackDepth() > 1) { OpcodeStack.Item itm = stack.getStackItem(1); int reg = itm.getRegisterNumber(); @@ -254,7 +258,7 @@ .addSourceLine(this)); } it.remove(); - break; + break; } } } else if (seen == ASTORE || seen >= ASTORE_0 && seen <= ASTORE_3) { @@ -263,7 +267,7 @@ catchInfos.clear(); break; } - + if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); int reg = RegisterUtils.getAStoreReg(this, seen); @@ -282,13 +286,13 @@ removeIndeterminateHandlers(pc); break; } - } + } } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); it.remove(); } } - + lastWasExitPoint = seen >= IRETURN && seen <= RETURN || seen == GOTO || seen == GOTO_W || seen == ATHROW; } finally { @@ -303,7 +307,7 @@ } } } - + /** returns whether the method called might be a method that builds an exception using * the original exception. It does so by looking to see if the method returns an exception, * and if one of the parameters is the original exception @@ -317,7 +321,7 @@ if (returnSig.startsWith("L")) { returnSig = returnSig.substring(1, returnSig.length() - 1); JavaClass retCls = Repository.lookupClass(returnSig); - if (retCls.instanceOf(throwableClass)) { + if (retCls.instanceOf(errorClass)) { int numParms = Type.getArgumentTypes(sig).length; if (stack.getStackDepth() >= numParms) { for (int p = 0; p < numParms; p++) { @@ -332,15 +336,15 @@ } return false; } - + /** returns whether the class in question was compiled with a jdk less than 1.4 - * + * * @param cls the class to check * @return whether the class is compiled with a jdk less than 1.4 */ private boolean isPre14Class(JavaClass cls) { - return cls != null && cls.getMajor() < Constants.MAJOR_1_4; + return cls != null && cls.getMajor() < Constants.MAJOR_1_4; } private void removePreviousHandlers(int pc) @@ -355,7 +359,7 @@ } } } - + private void removeIndeterminateHandlers(int pc) { Iterator<CatchInfo> it = catchInfos.iterator(); @@ -367,16 +371,16 @@ } } } - + /** - * looks to update the catchinfo block with the register used for the + * looks to update the catchinfo block with the register used for the * exception variable. If their is a local variable table, but the local * variable can't be found return false, signifying an empty catch block. - * + * * @param ci the catchinfo record for the catch starting at this pc * @param seen the opcode of the currently visited instruction * @param pc the current pc - * + * * @return whether the catch block is empty */ private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) { @@ -402,11 +406,11 @@ } return true; } - + /** * add a catch block info record for the catch block that is guessed to be * in the range of start to finish - * + * * @param start the handler pc * @param finish the guessed end of the catch block */ @@ -414,34 +418,34 @@ CatchInfo ci = new CatchInfo(start, finish); catchInfos.add(ci); } - + private static class CatchInfo { private final int catchStart; private int catchFinish; private int exReg; - + public CatchInfo(int start, int finish) { catchStart = start; catchFinish = finish; exReg = -1; } - + public void setReg(int reg) { exReg = reg; } - + public int getStart() { return catchStart; } - + public int getFinish() { return catchFinish; } - + public void setFinish(int finish) { catchFinish = finish; } - + public int getRegister() { return exReg; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-19 22:23:12
|
Revision: 1719 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1719&view=rev Author: dbrosius Date: 2012-10-19 22:23:05 +0000 (Fri, 19 Oct 2012) Log Message: ----------- tag v4_8_0 Added Paths: ----------- tags/v4_8_0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-19 22:08:45
|
Revision: 1718 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1718&view=rev Author: dbrosius Date: 2012-10-19 22:08:38 +0000 (Fri, 19 Oct 2012) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/htdocs/index.shtml Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-10-19 22:01:45 UTC (rev 1717) +++ trunk/fb-contrib/build.xml 2012-10-19 22:08:38 UTC (rev 1718) @@ -17,7 +17,7 @@ <property name="javac.deprecation" value="on" /> <property name="javac.debug" value="on" /> - <property name="fb-contrib.version" value="4.7.0" /> + <property name="fb-contrib.version" value="4.8.0" /> <property name="findbugs.version" value="2.0.0" /> <property name="findbugs-bcel.version" value="2.0.0" /> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2012-10-19 22:01:45 UTC (rev 1717) +++ trunk/fb-contrib/etc/findbugs.xml 2012-10-19 22:08:38 UTC (rev 1718) @@ -221,9 +221,9 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousGetterSetterUse" speed="fast" reports="SGSU_SUSPICIOUS_GETTER_SETTER_USE" /> <Detector class="com.mebigfatguy.fbcontrib.detect.LingeringGraphicsObjects" speed="fast" reports="LGO_LINGERING_GRAPHICS_OBJECT" /> - +<!-- <Detector class="com.mebigfatguy.fbcontrib.detect.StackedTryBlocks" speed="fast" reports="STB_STACKED_TRY_BLOCKS" /> - + --> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsEqualsBuilderToEquals" speed="fast" reports="CEBE_COMMONS_EQUALS_BUILDER_ISEQUALS" /> <Detector class="com.mebigfatguy.fbcontrib.detect.CommonsHashcodeBuilderToHashcode" speed="fast" reports="CHTH_COMMONS_HASHCODE_BUILDER_TOHASHCODE" /> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2012-10-19 22:01:45 UTC (rev 1717) +++ trunk/fb-contrib/htdocs/index.shtml 2012-10-19 22:08:38 UTC (rev 1718) @@ -72,25 +72,32 @@ <a href="http://sourceforge.net/projects/fb-contrib/files/Current/fb-contrib-4.6.1.jar/download">here</a>.</p> </div> + <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>[CVAA] ContraVariant Array Assignment</b><br/> + Looks for contravariant array assignments. Since arrays are mutable data structures, their use + must be restricted to covariant or invariant usage.<br/> + <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span></li> + <li><b>[STB] Stacked Try Blocks</b><br/> + Looks for two or more try catch blocks that are consecutive and catch the + same kind of exception, and throw the same exception always. These blocks can + be coalesced into one. + </li> + </ul> + </div> <hr/> - <img id="svn_image" src="flip2.gif" onClick="toggleBlock('svn', 'svn_image');" align="top"/> - Detectors added in svn<br/> - <div id="svn" style="display:block;"> + <img id="v4_8_0_image" src="flip2.gif" onClick="toggleBlock('v4_8_0', 'v4_8_0_image');" align="top"/> + Detectors added in v4.8.0<br/> + <div id="v4_8_0" style="display:block;"> <ul> - <li><b>[CVAA] ContraVariant Array Assignment</b><br/> - Looks for contravariant array assignments. Since arrays are mutable data structures, their use - must be restricted to covariant or invariant usage.<br/> - <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span></li> <li><b>[LGO] Lingering Graphics Object</b><br/> Looks for creation of java.awt.Graphics object that do not have the .dispose() method called on them when finished. These objects will be cleaned up by the Garbage collector, bug given the likelyhood that large numbers of these objects can be created in a short period of time, it is better to dispose them as soon as possible.</li> - <li><b>[STB] Stacked Try Blocks</b><br/> - Looks for two or more try catch blocks that are consecutive and catch the - same kind of exception, and throw the same exception always. These blocks can - be coalesced into one. - </li> <li><b>[CCNE] Compare Class Name Equals</b><br/> Looks for code that compares to classes by name, rather than by just comparing the classes with ==<br/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-19 22:01:51
|
Revision: 1717 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1717&view=rev Author: dbrosius Date: 2012-10-19 22:01:45 +0000 (Fri, 19 Oct 2012) Log Message: ----------- sync from github Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/htdocs/index.shtml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2012-10-19 21:52:20 UTC (rev 1716) +++ trunk/fb-contrib/etc/messages.xml 2012-10-19 22:01:45 UTC (rev 1717) @@ -1275,7 +1275,7 @@ <Details> <![CDATA[ <p> Looks for classes that implement clone() that do not specialize the return value, and do - not swallow CloneNotFoundException. Not doing so makes the clone method not as simple to use, + not swallow CloneNotSupportedException. Not doing so makes the clone method not as simple to use, and should be harmless to do so. </p> ]]> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2012-10-19 21:52:20 UTC (rev 1716) +++ trunk/fb-contrib/htdocs/index.shtml 2012-10-19 22:01:45 UTC (rev 1717) @@ -120,7 +120,7 @@ </li> <li><b>[CU] Clone Usability</b><br/> Looks for classes that implement clone() that do not specialize the return value, and do - not swallow CloneNotFoundException. Not doing so makes the clone method not as simple + not swallow CloneNotSupportedException. Not doing so makes the clone method not as simple to use, and should be harmless to do. </li> </ul> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2012-10-19 21:52:27
|
Revision: 1716 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1716&view=rev Author: dbrosius Date: 2012-10-19 21:52:20 +0000 (Fri, 19 Oct 2012) Log Message: ----------- synchronize with github Modified Paths: -------------- trunk/fb-contrib/.classpath trunk/fb-contrib/build.xml trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml trunk/fb-contrib/htdocs/index.shtml trunk/fb-contrib/samples/PRMC_Sample.java trunk/fb-contrib/samples/samples.fbp Modified: trunk/fb-contrib/.classpath =================================================================== --- trunk/fb-contrib/.classpath 2012-07-04 23:24:26 UTC (rev 1715) +++ trunk/fb-contrib/.classpath 2012-10-19 21:52:20 UTC (rev 1716) @@ -16,12 +16,13 @@ <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/asm-util-3.3.jar"/> <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/bcel.jar"/> <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/dom4j-1.6.1.jar"/> - <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/findbugs.jar"/> + <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/findbugs.jar" sourcepath="/findbugs"/> <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jaxen-1.1.1.jar"/> <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jFormatString.jar"/> <classpathentry kind="lib" path="/home/dave/dev/avondale/3rdparty/findbugs/lib/jsr305.jar"/> <classpathentry kind="lib" path="samples/lib/commons-lang3-3.1.jar"/> <classpathentry kind="lib" path="samples/lib/backport-concurrent-3.1.jar"/> - <classpathentry kind="lib" path="samples/lib/commons-collection-${commons-collection.version}.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/findbugs"/> + <classpathentry kind="lib" path="samples/lib/commons-collections-3.2.1.jar"/> <classpathentry kind="output" path="classes"/> </classpath> Modified: trunk/fb-contrib/build.xml =================================================================== --- trunk/fb-contrib/build.xml 2012-07-04 23:24:26 UTC (rev 1715) +++ trunk/fb-contrib/build.xml 2012-10-19 21:52:20 UTC (rev 1716) @@ -43,8 +43,8 @@ <property name="junit-url" value="http://repo1.maven.org/maven2/junit/junit/${junit.version}/junit-${junit.version}.jar" /> <property name="log4j-url" value="http://repo1.maven.org/maven2/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar" /> <property name="servlet-api-url" value="http://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/${servlet-api.version}/javax.servlet-api-${servlet-api.version}.jar" /> - <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-util-concurrent/backport-util-concurrent/${backport-concurrent.version}/backport-util-concurrent-${backport-concurrent.version}.jar" /> - <property name="commons-collection-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" /> + <property name="backport-concurrent-url" value="http://repo1.maven.org/maven2/backport-concurrent/backport-concurrent/${backport-concurrent.version}/backport-concurrent-${backport-concurrent.version}.jar" /> + <property name="commons-collections-url" value="http://repo1.maven.org/maven2/commons-collections/commons-collections/${commons-collections.version}/commons-collections-${commons-collections.version}.jar" /> <target name="check"> <available file="${dest}/${name}-${version}.jar" property="jar-exists" /> @@ -81,7 +81,7 @@ <pull url="${log4j-url}" dest="${sampleslib.dir}" name="log4j" version="${log4j.version}" /> <pull url="${servlet-api-url}" dest="${sampleslib.dir}" name="servlet-api" version="${servlet-api.version}" /> <pull url="${backport-concurrent-url}" dest="${sampleslib.dir}" name="backport-concurrent" version="${backport-concurrent.version}" /> - <pull url="${commons-collection-url}" dest="${sampleslib.dir}" name="commons-collection" version="${commons-collection.version}" /> + <pull url="${commons-collections-url}" dest="${sampleslib.dir}" name="commons-collections" version="${commons-collections.version}" /> </target> <target name="clean" description="removes all generated collateral"> @@ -105,7 +105,7 @@ <mkdir dir="${javadoc.dir}" /> <path id="fb-contrib.classpath"> <pathelement location="${lib.dir}/findbugs-${findbugs.version}.jar" /> - <pathelement location="${lib.dir}/bcel-${findbugs-bcel.version}.jar" /> + <pathelement location="${lib.dir}/findbugs-bcel-${findbugs-bcel.version}.jar" /> <pathelement location="${lib.dir}/annotations-${annotations.version}.jar" /> <pathelement location="${lib.dir}/asm-tree-${asm-tree.version}.jar" /> </path> @@ -116,7 +116,7 @@ <pathelement location="${sampleslib.dir}/log4j-${log4j.version}.jar" /> <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" /> <pathelement location="${sampleslib.dir}/commons-lang3-${commons-lang3.version}.jar" /> - <pathelement location="${sampleslib.dir}/backport-util-concurrent-${backport-concurrent.version}.jar" /> + <pathelement location="${sampleslib.dir}/backport-concurrent-${backport-concurrent.version}.jar" /> </path> <mkdir dir="${classes.dir}/com" /> <mkdir dir="${classes.dir}/com/mebigfatguy" /> Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2012-07-04 23:24:26 UTC (rev 1715) +++ trunk/fb-contrib/etc/findbugs.xml 2012-10-19 21:52:20 UTC (rev 1716) @@ -234,6 +234,8 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.BackportReusePublicIdentifiers" speed="fast" reports="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability" speed="fast" reports="CU_CLONE_USABILITY_OBJECT_RETURN,CU_CLONE_USABILITY_THROWS" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -406,4 +408,6 @@ <BugPattern abbrev="CSBTS" type="CSBTS_COMMONS_STRING_BUILDER_TOSTRING" category="CORRECTNESS" /> <BugPattern abbrev="CCNE" type="CCNE_COMPARE_CLASS_EQUALS_NAME" category="CORRECTNESS" /> <BugPattern abbrev="BRPI" type="BRPI_BACKPORT_REUSE_PUBLIC_IDENTIFIERS" category ="PERFORMANCE" /> + <BugPattern abbrev="CU" type="CU_CLONE_USABILITY_OBJECT_RETURN" category="STYLE" /> + <BugPattern abbrev="CU" type="CU_CLONE_USABILITY_THROWS" category="STYLE" /> </FindbugsPlugin> Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2012-07-04 23:24:26 UTC (rev 1715) +++ trunk/fb-contrib/etc/messages.xml 2012-10-19 21:52:20 UTC (rev 1716) @@ -1271,6 +1271,17 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.CloneUsability"> + <Details> + <![CDATA[ + <p> Looks for classes that implement clone() that do not specialize the return value, and do + not swallow CloneNotFoundException. Not doing so makes the clone method not as simple to use, + and should be harmless to do so. + </p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -3447,14 +3458,42 @@ <LongDescription>Method {1} backport concurrency utils</LongDescription> <Details> <![CDATA[ - <p> Detects use of Backport Utils concurrent classes. Updated/Efficient version of these + <p> This class usees Backport Utils concurrent classes. Updated/Efficient version of these classes are available in versions of the JDK 5.0 and higher, and these classes should only be used if you are targeting JDK 1.4 and lower. </p> ]]> </Details> </BugPattern> + + <BugPattern type="CU_CLONE_USABILITY_OBJECT_RETURN"> + <ShortDescription>Clone method declares it returns an Object</ShortDescription> + <LongDescription>Clone method {1} declares it returns an Object</LongDescription> + <Details> + <![CDATA[ + <p> This class implements the Cloneable interface but defines its clone method to return an + Object. Since most likely users of this method will need to cast it to the real type, this will + be more painful than necessary. Just declare the return value to be the type of this class. + </p> + ]]> + </Details> + </BugPattern> + <BugPattern type="CU_CLONE_USABILITY_THROWS"> + <ShortDescription>Clone method declares it throws CloneNotSupportedException</ShortDescription> + <LongDescription>Clone method {1} declares it throws CloneNotSupportedException</LongDescription> + <Details> + <![CDATA[ + <p> This class implements the Cloneable interface but defines its clone method to still return + a CloneNotSupportedException. Since you are implementing clone() it would make sense that the method + in question will _not_ throw that exception, so annotating your method with it just makes client use + of your more painful as they have to handle an exception that will never happen. Just remove the + throws clause from your method. + </p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -3562,4 +3601,5 @@ <BugCode abbrev="CSBTS">Commons ToStringBuilder To String</BugCode> <BugCode abbrev="CCNE">Compare class name equals</BugCode> <BugCode abbrev="BRPI">Backport concurrent reuse of public identifiers</BugCode> + <BugCode abbrev="CU">Clone Usability</BugCode> </MessageCollection> Modified: trunk/fb-contrib/htdocs/index.shtml =================================================================== --- trunk/fb-contrib/htdocs/index.shtml 2012-07-04 23:24:26 UTC (rev 1715) +++ trunk/fb-contrib/htdocs/index.shtml 2012-10-19 21:52:20 UTC (rev 1716) @@ -118,6 +118,11 @@ classes should only be used if you are targeting JDK 1.4 and lower.<br/> <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span> </li> + <li><b>[CU] Clone Usability</b><br/> + Looks for classes that implement clone() that do not specialize the return value, and do + not swallow CloneNotFoundException. Not doing so makes the clone method not as simple + to use, and should be harmless to do. + </li> </ul> </div> <hr/> Modified: trunk/fb-contrib/samples/PRMC_Sample.java =================================================================== --- trunk/fb-contrib/samples/PRMC_Sample.java 2012-07-04 23:24:26 UTC (rev 1715) +++ trunk/fb-contrib/samples/PRMC_Sample.java 2012-10-19 21:52:20 UTC (rev 1716) @@ -1,12 +1,14 @@ import java.nio.ByteBuffer; import java.util.Calendar; import java.util.Date; +import java.util.HashSet; +import java.util.Set; @SuppressWarnings("all") -public class PRMC_Sample +public class PRMC_Sample { String data; - + public boolean test1(Calendar c) { Date d = c.getTime(); @@ -15,23 +17,23 @@ long j = e.getTime(); return l == j; } - + public void rmcFP(ByteBuffer bb) { int i = bb.getInt(); int j = bb.getInt(); } - + @Override public boolean equals(Object o) { PRMC_Sample rmc = (PRMC_Sample)o; if (data.equals("INF") || rmc.data.equals("INF")) return false; - + return data.equals(rmc.data); } - + public void staticPRMC() { Factory.getInstance().fee(); @@ -39,43 +41,55 @@ Factory.getInstance().fo(); Factory.getInstance().fum(); } - + static class Factory { private static Factory f = new Factory(); - + private Factory() { } - + public static Factory getInstance() { return f; } - + public void fee() { } - + public void fi() { } - + public void fo() { } - + public void fum() { } } - + public long fpCurrentTimeMillis(Object o) { long time = -System.currentTimeMillis(); o.hashCode(); time += System.currentTimeMillis(); - + return time; } + + public void fpEnumToString(FPEnum e) + { + Set<String> s = new HashSet<String>(); + + s.add(FPEnum.fee.toString()); + s.add(FPEnum.fi.toString()); + s.add(FPEnum.fo.toString()); + s.add(FPEnum.fum.toString()); + } + + enum FPEnum { fee, fi, fo, fum }; } Modified: trunk/fb-contrib/samples/samples.fbp =================================================================== --- trunk/fb-contrib/samples/samples.fbp 2012-07-04 23:24:26 UTC (rev 1715) +++ trunk/fb-contrib/samples/samples.fbp 2012-10-19 21:52:20 UTC (rev 1716) @@ -1,12 +1,11 @@ -<Project projectName=""> +<Project projectName="sample"> <Jar>.</Jar> - <AuxClasspathEntry>./lib/jsp-api.jar</AuxClasspathEntry> - <AuxClasspathEntry>./lib/junit.jar</AuxClasspathEntry> - <AuxClasspathEntry>./lib/log4j.jar</AuxClasspathEntry> - <AuxClasspathEntry>./lib/servlet-api.jar</AuxClasspathEntry> + <AuxClasspathEntry>./lib/jsp-api-2.2.1.jar</AuxClasspathEntry> + <AuxClasspathEntry>./lib/junit-4.10.jar</AuxClasspathEntry> + <AuxClasspathEntry>./lib/log4j-1.2.16.jar</AuxClasspathEntry> + <AuxClasspathEntry>./lib/servlet-api-3.0.1.jar</AuxClasspathEntry> <SrcDir>.</SrcDir> <SuppressionFilter> <LastVersion value="-1" relOp="NEQ"/> </SuppressionFilter> - <Cloud id="1"></Cloud> </Project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |