fb-contrib-commit Mailing List for fb-contrib (Page 19)
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...> - 2009-12-19 18:05:43
|
Revision: 1391 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1391&view=rev Author: dbrosius Date: 2009-12-19 18:05:32 +0000 (Sat, 19 Dec 2009) Log Message: ----------- new detector (Wrong Null Guard) Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml Added Paths: ----------- trunk/fb-contrib/.settings/ trunk/fb-contrib/samples/WNG_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-11-26 03:25:08 UTC (rev 1390) +++ trunk/fb-contrib/etc/findbugs.xml 2009-12-19 18:05:32 UTC (rev 1391) @@ -1,519 +1,569 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- - Plugin descriptor for fb-contrib plugin. - This plugin is enabled by default. ---> + <!-- + Plugin descriptor for fb-contrib plugin. This plugin is enabled by + default. + --> <FindbugsPlugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="findbugsplugin.xsd" - pluginid="com.mebigfatguy.fbcontrib" - defaultenabled="true" - provider="fb-contrib project" - website="http://fb-contrib.sourceforge.net"> - - <!-- Passes --> - - <OrderingConstraints> - <SplitPass> - <Earlier class="com.mebigfatguy.fbcontrib.collect.CollectStatistics"/> - <LaterCategory name="reporting" spanplugins="true"/> - </SplitPass> - </OrderingConstraints> - - <!-- Detectors --> - - <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" - speed="fast" - reports="" - hidden="true" /> - - - <Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering" - speed="fast" - reports="ISB_INEFFICIENT_STRING_BUFFERING,ISB_EMPTY_STRING_APPENDING" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators" - speed="slow" - reports="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.CyclomaticComplexity" - speed="slow" - reports="CC_CYCLOMATIC_COMPLEXITY" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.OverlyConcreteParameter" - speed="slow" - reports="OCP_OVERLY_CONCRETE_PARAMETER" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ListIndexedIterating" - speed="moderate" - reports="LII_LIST_INDEXED_ITERATING" /> - - <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" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" - speed="fast" - reports="CE_CLASS_ENVY" - disabled="true" /> - - <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" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousListCollection" - speed="fast" - reports="DLC_DUBIOUS_LIST_COLLECTION" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ParallelLists" - speed="fast" - reports="PL_PARALLEL_LISTS" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.FinalParameters" - speed="slow" - reports="FP_FINAL_PARAMETERS" /> + xsi:noNamespaceSchemaLocation="findbugsplugin.xsd" pluginid="com.mebigfatguy.fbcontrib" + defaultenabled="true" provider="fb-contrib project" website="http://fb-contrib.sourceforge.net"> - <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractClassEmptyMethods" - speed="fast" - reports="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" /> + <!-- Passes --> - <Detector class="com.mebigfatguy.fbcontrib.detect.ManualArrayCopy" - speed="fast" - reports="MAC_MANUAL_ARRAY_COPY" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.FloatingPointLoops" - speed="fast" - reports="FPL_FLOATING_POINT_LOOPS" /> + <OrderingConstraints> + <SplitPass> + <Earlier class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" /> + <LaterCategory name="reporting" spanplugins="true" /> + </SplitPass> + </OrderingConstraints> - <Detector class="com.mebigfatguy.fbcontrib.detect.NonCollectionMethodUse" - speed="fast" - reports="NCMU_NON_COLLECTION_METHOD_USE" /> + <!-- Detectors --> - <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingAutoboxedOverloading" - speed="fast" - reports="CAO_CONFUSING_AUTOBOXED_OVERLOADING" /> + <Detector class="com.mebigfatguy.fbcontrib.collect.CollectStatistics" + speed="fast" reports="" hidden="true" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.AbnormalFinallyBlockReturn" - speed="fast" - reports="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.StaticMethodInstanceInvocation" - speed="fast" - reports="SMII_STATIC_METHOD_INSTANCE_INVOCATION" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SpuriousThreadStates" - speed="fast" - reports="STS_SPURIOUS_THREAD_STATES" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessAutoboxing" - speed="fast" - reports="NAB_NEEDLESS_AUTOBOXING_CTOR,NAB_NEEDLESS_BOXING_STRING_CTOR,NAB_NEEDLESS_AUTOBOXING_VALUEOF,NAB_NEEDLESS_BOXING_PARSE,NAB_NEEDLESS_BOXING_VALUEOF,NAB_NEEDLESS_BOX_TO_UNBOX,NAB_NEEDLESS_BOX_TO_CAST,NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.InefficientStringBuffering" + speed="fast" reports="ISB_INEFFICIENT_STRING_BUFFERING,ISB_EMPTY_STRING_APPENDING" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn" - speed="fast" - reports="USBR_UNNECESSARY_STORE_BEFORE_RETURN" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod" - speed="fast" - reports="COM_COPIED_OVERRIDDEN_METHOD" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayBasedCollections" - speed="fast" - reports="ABC_ARRAY_BASED_COLLECTIONS" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.OrphanedDOMNode" - speed="fast" - reports="ODN_ORPHANED_DOM_NODE" /> - - <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" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" - speed="fast" - reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" - hidden="true" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.ConstantListIndex" - speed="fast" - reports="CLI_CONSTANT_LIST_INDEX" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SyncCollectionIterators" + speed="slow" reports="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.SloppyClassReflection" - speed="fast" - reports="SCR_SLOPPY_CLASS_REFLECTION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.CyclomaticComplexity" + speed="slow" reports="CC_CYCLOMATIC_COMPLEXITY" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayWrappedCallByReference" - speed="fast" - reports="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.OverlyConcreteParameter" + speed="slow" reports="OCP_OVERLY_CONCRETE_PARAMETER" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.SluggishGui" - speed="fast" - reports="SG_SLUGGISH_GUI" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessInstanceRetrieval" - speed="fast" - reports="NIR_NEEDLESS_INSTANCE_RETRIEVAL" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.DateComparison" - speed="fast" - reports="DDC_DOUBLE_DATE_COMPARISON" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousWaitOnConcurrentObject" - speed="fast" - reports="SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT" /> - + <Detector class="com.mebigfatguy.fbcontrib.detect.ListIndexedIterating" + speed="moderate" reports="LII_LIST_INDEXED_ITERATING" /> + + <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" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ClassEnvy" + speed="fast" reports="CE_CLASS_ENVY" disabled="true" /> + + <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" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousListCollection" + speed="fast" reports="DLC_DUBIOUS_LIST_COLLECTION" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ParallelLists" + speed="fast" reports="PL_PARALLEL_LISTS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.FinalParameters" + speed="slow" reports="FP_FINAL_PARAMETERS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.AbstractClassEmptyMethods" + speed="fast" reports="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ManualArrayCopy" + speed="fast" reports="MAC_MANUAL_ARRAY_COPY" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.FloatingPointLoops" + speed="fast" reports="FPL_FLOATING_POINT_LOOPS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NonCollectionMethodUse" + speed="fast" reports="NCMU_NON_COLLECTION_METHOD_USE" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.ConfusingAutoboxedOverloading" + speed="fast" reports="CAO_CONFUSING_AUTOBOXED_OVERLOADING" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.AbnormalFinallyBlockReturn" + speed="fast" reports="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.StaticMethodInstanceInvocation" + speed="fast" reports="SMII_STATIC_METHOD_INSTANCE_INVOCATION" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.SpuriousThreadStates" + speed="fast" reports="STS_SPURIOUS_THREAD_STATES" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessAutoboxing" + speed="fast" + reports="NAB_NEEDLESS_AUTOBOXING_CTOR,NAB_NEEDLESS_BOXING_STRING_CTOR,NAB_NEEDLESS_AUTOBOXING_VALUEOF,NAB_NEEDLESS_BOXING_PARSE,NAB_NEEDLESS_BOXING_VALUEOF,NAB_NEEDLESS_BOX_TO_UNBOX,NAB_NEEDLESS_BOX_TO_CAST,NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.UnnecessaryStoreBeforeReturn" + speed="fast" reports="USBR_UNNECESSARY_STORE_BEFORE_RETURN" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.CopiedOverriddenMethod" + speed="fast" reports="COM_COPIED_OVERRIDDEN_METHOD" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayBasedCollections" + speed="fast" reports="ABC_ARRAY_BASED_COLLECTIONS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.OrphanedDOMNode" + speed="fast" reports="ODN_ORPHANED_DOM_NODE" /> + + <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" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedSynchronizedBlock" + speed="fast" reports="BSB_BLOATED_SYNCHRONIZED_BLOCK" hidden="true" /> + + <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" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.ArrayWrappedCallByReference" + speed="fast" reports="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.SluggishGui" + speed="fast" reports="SG_SLUGGISH_GUI" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessInstanceRetrieval" + speed="fast" reports="NIR_NEEDLESS_INSTANCE_RETRIEVAL" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.DateComparison" + speed="fast" reports="DDC_DOUBLE_DATE_COMPARISON" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SuspiciousWaitOnConcurrentObject" + speed="fast" reports="SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.JDBCVendorReliance" - speed="fast" - reports="JVR_JDBC_VENDOR_RELIANCE" /> - + speed="fast" reports="JVR_JDBC_VENDOR_RELIANCE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.PossibleMemoryBloat" - speed="fast" - reports="PMB_POSSIBLE_MEMORY_BLOAT" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.LocalSynchronizedCollection" - speed="moderate" - reports="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" /> - + speed="fast" reports="PMB_POSSIBLE_MEMORY_BLOAT" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.LocalSynchronizedCollection" + speed="moderate" reports="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.FieldCouldBeLocal" - speed="slow" - reports="FCBL_FIELD_COULD_BE_LOCAL" /> - + speed="slow" reports="FCBL_FIELD_COULD_BE_LOCAL" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.NonOwnedSynchronization" - speed="fast" - reports="NOS_NON_OWNED_SYNCHRONIZATION" /> - + speed="fast" reports="NOS_NON_OWNED_SYNCHRONIZATION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.NonRecycleableTaglibs" - speed="fast" - reports="NRTL_NON_RECYCLEABLE_TAG_LIBS" /> - + speed="fast" reports="NRTL_NON_RECYCLEABLE_TAG_LIBS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.Section508Compliance" - speed="fast" - reports="S508C_NULL_LAYOUT,S508C_NO_SETLABELFOR,S508C_NO_SETSIZE,S508C_NON_ACCESSIBLE_JCOMPONENT,S508C_SET_COMP_COLOR" /> - + speed="fast" + reports="S508C_NULL_LAYOUT,S508C_NO_SETLABELFOR,S508C_NO_SETSIZE,S508C_NON_ACCESSIBLE_JCOMPONENT,S508C_SET_COMP_COLOR" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UseEnumCollections" - speed="fast" - reports="UEC_USE_ENUM_COLLECTIONS" /> - + speed="fast" reports="UEC_USE_ENUM_COLLECTIONS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SQLInLoop" - speed="fast" - reports="SIL_SQL_IN_LOOP" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessMemberCollectionSynchronization" - speed="moderate" - reports="NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION" /> - + speed="fast" reports="SIL_SQL_IN_LOOP" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.NeedlessMemberCollectionSynchronization" + speed="moderate" reports="NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.InheritanceTypeChecking" - speed="moderate" - reports="ITC_INHERITANCE_TYPE_CHECKING" /> - + speed="moderate" reports="ITC_INHERITANCE_TYPE_CHECKING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.StaticArrayCreatedInMethod" - speed="fast" - reports="SACM_STATIC_ARRAY_CREATED_IN_METHOD" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.PossiblyRedundantMethodCalls" - speed="fast" - reports="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" /> - + speed="fast" reports="SACM_STATIC_ARRAY_CREATED_IN_METHOD" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.PossiblyRedundantMethodCalls" + speed="fast" reports="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UseToArray" - speed="fast" - reports="UTA_USE_TO_ARRAY" /> - + speed="fast" reports="UTA_USE_TO_ARRAY" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.LostExceptionStackTrace" - speed="moderate" - reports="LEST_LOST_EXCEPTION_STACK_TRACE" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.UseCharacterParameterizedMethod" - speed="fast" - reports="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" /> - + speed="moderate" reports="LEST_LOST_EXCEPTION_STACK_TRACE" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.UseCharacterParameterizedMethod" + speed="fast" reports="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.TailRecursion" - speed="fast" - reports="TR_TAIL_RECURSION" /> - + speed="fast" reports="TR_TAIL_RECURSION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UnrelatedReturnValues" - speed="fast" - reports="URV_UNRELATED_RETURN_VALUES,URV_CHANGE_RETURN_TYPE,URV_INHERITED_METHOD_WITH_RELATED_TYPES" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.PossibleIncompleteSerialization" - speed="fast" - reports="PIS_POSSIBLE_INCOMPLETE_SERIALIZATION" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" - speed="fast" - reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" /> - + speed="fast" + reports="URV_UNRELATED_RETURN_VALUES,URV_CHANGE_RETURN_TYPE,URV_INHERITED_METHOD_WITH_RELATED_TYPES" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.PossibleIncompleteSerialization" + speed="fast" reports="PIS_POSSIBLE_INCOMPLETE_SERIALIZATION" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SuspiciousComparatorReturnValues" + speed="fast" reports="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SillynessPotPourri" - speed="fast" - reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING" /> - + speed="fast" + reports="SPP_NEGATIVE_BITSET_ITEM,SPP_INTERN_ON_CONSTANT,SPP_NO_CHAR_SB_CTOR,SPP_USE_MATH_CONSTANT,SPP_STUTTERED_ASSIGNMENT,SPP_USE_ISNAN,SPP_USE_BIGDECIMAL_STRING_CTOR,SPP_STRINGBUFFER_WITH_EMPTY_STRING,SPP_EQUALS_ON_ENUM,SPP_INVALID_BOOLEAN_NULL_CHECK,SPP_USE_CHARAT,SPP_USELESS_TRINARY,SPP_SUSPECT_STRING_TEST,SPP_USE_STRINGBUILDER_LENGTH,SPP_INVALID_CALENDAR_COMPARE,SPP_USE_CONTAINSKEY,SPP_USE_ISEMPTY,SPP_USE_GETPROPERTY,SPP_USELESS_CASING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.BloatedAssignmentScope" - speed="fast" - reports="BAS_BLOATED_ASSIGNMENT_SCOPE" - hidden="true" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" - speed="fast" - reports="SCI_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" /> - + speed="fast" reports="BAS_BLOATED_ASSIGNMENT_SCOPE" hidden="true" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor" + speed="fast" reports="SCI_SPOILED_CHILD_INTERFACE_IMPLEMENTOR" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.DeletingWhileIterating" - speed="fast" - reports="DWI_DELETING_WHILE_ITERATING,DWI_MODIFYING_WHILE_ITERATING" /> - + speed="fast" reports="DWI_DELETING_WHILE_ITERATING,DWI_MODIFYING_WHILE_ITERATING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UseSplit" - speed="fast" - reports="USS_USE_STRING_SPLIT" /> - + speed="fast" reports="USS_USE_STRING_SPLIT" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousJDKVersionUse" - speed="slow" - reports="SJVU_SUSPICIOUS_JDK_VERSION_USE" - disabled="true" /> - + speed="slow" reports="SJVU_SUSPICIOUS_JDK_VERSION_USE" disabled="true" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.UseAddAll" - speed="fast" - reports="UAA_USE_ADD_ALL" /> - + speed="fast" reports="UAA_USE_ADD_ALL" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.MethodReturnsConstant" - speed="fast" - reports="MRC_METHOD_RETURNS_CONSTANT" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NeedlessCustomSerialization" - speed="fast" - reports="NCS_NEEDLESS_CUSTOM_SERIALIZATION" /> - + speed="fast" reports="MRC_METHOD_RETURNS_CONSTANT" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.NeedlessCustomSerialization" + speed="fast" reports="NCS_NEEDLESS_CUSTOM_SERIALIZATION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.MisleadingOverloadModel" - speed="fast" - reports="MOM_MISLEADING_OVERLOAD_MODEL" /> - + speed="fast" reports="MOM_MISLEADING_OVERLOAD_MODEL" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ExceptionSoftening" - speed="moderate" - reports="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS,EXS_EXCEPTION_SOFTENING_HAS_CHECKED,EXS_EXCEPTION_SOFTENING_NO_CHECKED" /> - + speed="moderate" + reports="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS,EXS_EXCEPTION_SOFTENING_HAS_CHECKED,EXS_EXCEPTION_SOFTENING_NO_CHECKED" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ConfusingFunctionSemantics" - speed="fast" - reports="CFS_CONFUSING_FUNCTION_SEMANTICS" /> - + speed="fast" reports="CFS_CONFUSING_FUNCTION_SEMANTICS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.JUnitAssertionOddities" - speed="fast" - reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT,JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" /> - + speed="fast" + reports="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT,JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE,JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT,JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousCloneAlgorithm" - speed="fast" - reports="SCA_SUSPICIOUS_CLONE_ALGORITHM" /> - + speed="fast" reports="SCA_SUSPICIOUS_CLONE_ALGORITHM" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.WeakExceptionMessaging" - speed="fast" - reports="WEM_WEAK_EXCEPTION_MESSAGING" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousClusteredSessionSupport" - speed="fast" - reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" /> - + speed="fast" reports="WEM_WEAK_EXCEPTION_MESSAGING" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SuspiciousClusteredSessionSupport" + speed="fast" reports="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.LoggerOddities" - speed="fast" - reports="LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER" /> - + speed="fast" reports="LO_SUSPECT_LOG_CLASS,LO_SUSPECT_LOG_PARAMETER" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.IncorrectInternalClassUse" - speed="fast" - reports="IICU_INCORRECT_INTERNAL_CLASS_USE" /> - + speed="fast" reports="IICU_INCORRECT_INTERNAL_CLASS_USE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.DubiousSetOfCollections" - speed="moderate" - reports="DSOC_DUBIOUS_SET_OF_COLLECTIONS" /> - + speed="moderate" reports="DSOC_DUBIOUS_SET_OF_COLLECTIONS" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.BogusExceptionDeclaration" - speed="moderate" - reports="BED_BOGUS_EXCEPTION_DECLARATION" /> - + speed="moderate" reports="BED_BOGUS_EXCEPTION_DECLARATION" /> + <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" /> - + speed="fast" reports="UNNC_UNNECESSARY_NEW_NULL_CHECK" /> + + <Detector + class="com.mebigfatguy.fbcontrib.detect.DeprecatedTypesafeEnumPattern" + speed="fast" reports="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.StutteredMethodArguments" - speed="fast" - reports="SMA_STUTTERED_METHOD_ARGUMENTS" - hidden="true" /> - + speed="fast" reports="SMA_STUTTERED_METHOD_ARGUMENTS" hidden="true" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.TristateBooleanPattern" - speed="fast" - reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> - - - <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousUninitializedArray" - speed="fast" - reports="SUA_SUSPICIOUS_UNINITIALIZED_ARRAY" /> - + speed="fast" reports="TBP_TRISTATE_BOOLEAN_PATTERN" /> + + + <Detector + class="com.mebigfatguy.fbcontrib.detect.SuspiciousUninitializedArray" + speed="fast" reports="SUA_SUSPICIOUS_UNINITIALIZED_ARRAY" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.InappropriateToStringUse" - speed="fast" - reports="ITU_INAPPROPRIATE_TOSTRING_USE" /> - + speed="fast" reports="ITU_INAPPROPRIATE_TOSTRING_USE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.InconsistentKeyNameCasing" - speed="fast" - reports="IKNC_INCONSISTENT_HTTP_PARAM_CASING" /> - + speed="fast" reports="IKNC_INCONSISTENT_HTTP_PARAM_CASING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.OverzealousCasting" - speed="fast" - reports="OC_OVERZEALOUS_CASTING" /> - + speed="fast" reports="OC_OVERZEALOUS_CASTING" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.PoorlyDefinedParameter" - speed="fast" - reports="PDP_POORLY_DEFINED_PARAMETER" /> - + speed="fast" reports="PDP_POORLY_DEFINED_PARAMETER" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" - speed="fast" - reports="NSE_NON_SYMMETRIC_EQUALS" /> + speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> - <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" - speed="fast" - reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" /> - - <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" - speed="fast" - reports="NFF_NON_FUNCTIONAL_FIELD" /> - - <!-- BugPattern --> - - <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> - <BugPattern abbrev="ISB" type="ISB_EMPTY_STRING_APPENDING" category="PERFORMANCE" /> - <BugPattern abbrev="SCI" type="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" category="CORRECTNESS" /> - <BugPattern abbrev="CC" type="CC_CYCLOMATIC_COMPLEXITY" category="STYLE" /> - <BugPattern abbrev="OCP" type="OCP_OVERLY_CONCRETE_PARAMETER" category="STYLE" /> - <BugPattern abbrev="LII" type="LII_LIST_INDEXED_ITERATING" category="STYLE" /> - <BugPattern abbrev="UCC" type="UCC_UNRELATED_COLLECTION_CONTENTS" category="STYLE" /> - <BugPattern abbrev="DRE" type="DRE_DECLARED_RUNTIME_EXCEPTION" category="STYLE" /> - <BugPattern abbrev="CE" type="CE_CLASS_ENVY" category="STYLE" experimental="true" /> - <BugPattern abbrev="LSC" type="LSC_LITERAL_STRING_COMPARISON" category="STYLE" /> - <BugPattern abbrev="PCOA" type="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" category="CORRECTNESS" /> - <BugPattern abbrev="DLC" type="DLC_DUBIOUS_LIST_COLLECTION" category="PERFORMANCE" /> - <BugPattern abbrev="PL" type="PL_PARALLEL_LISTS" category="STYLE" /> - <BugPattern abbrev="FP" type="FP_FINAL_PARAMETERS" category="STYLE" /> - <BugPattern abbrev="ACEM" type="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" category="STYLE" /> - <BugPattern abbrev="MAC" type="MAC_MANUAL_ARRAY_COPY" category="PERFORMANCE" /> - <BugPattern abbrev="FPL" type="FPL_FLOATING_POINT_LOOPS" category="CORRECTNESS" /> - <BugPattern abbrev="NCMU" type="NCMU_NON_COLLECTION_METHOD_USE" category="STYLE" /> - <BugPattern abbrev="CAO" type="CAO_CONFUSING_AUTOBOXED_OVERLOADING" category="CORRECTNESS" /> - <BugPattern abbrev="AFBR" type="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" category="CORRECTNESS" /> - <BugPattern abbrev="SMII" type="SMII_STATIC_METHOD_INSTANCE_INVOCATION" category="STYLE" /> - <BugPattern abbrev="STS" type="STS_SPURIOUS_THREAD_STATES" category="MT_CORRECTNESS" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING_CTOR" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_STRING_CTOR" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING_VALUEOF" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_PARSE" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_VALUEOF" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_UNBOX" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_CAST" category="PERFORMANCE" /> - <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" category="PERFORMANCE" /> - <BugPattern abbrev="USBR" type="USBR_UNNECESSARY_STORE_BEFORE_RETURN" category="STYLE" /> - <BugPattern abbrev="COM" type="COM_COPIED_OVERRIDDEN_METHOD" category="STYLE" /> - <BugPattern abbrev="ABC" type="ABC_ARRAY_BASED_COLLECTIONS" category="CORRECTNESS" /> - <BugPattern abbrev="ODN" type="ODN_ORPHANED_DOM_NODE" category="CORRECTNESS" /> - <BugPattern abbrev="AOM" type="AOM_ABSTRACT_OVERRIDDEN_METHOD" category="CORRECTNESS" /> - <BugPattern abbrev="CBX" type="CBX_CUSTOM_BUILT_XML" category="STYLE" /> - <BugPattern abbrev="BSB" type="BSB_BLOATED_SYNCHRONIZED_BLOCK" category="PERFORMANCE" experimental="true" /> - <BugPattern abbrev="CLI" type="CLI_CONSTANT_LIST_INDEX" category="CORRECTNESS" /> - <BugPattern abbrev="SCR" type="SCR_SLOPPY_CLASS_REFLECTION" category="STYLE" /> - <BugPattern abbrev="AWCBR" type="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" category="STYLE" /> + <Detector + class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" + speed="fast" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" + speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.WrongNullGuard" + speed="fast" reports="WNG_WRONG_NULL_FIELD_GUARD,WNG_WRONG_NULL_LOCAL_GUARD" /> + + <!-- BugPattern --> + + <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" + category="PERFORMANCE" /> + <BugPattern abbrev="ISB" type="ISB_EMPTY_STRING_APPENDING" + category="PERFORMANCE" /> + <BugPattern abbrev="SCI" type="SCI_SYNCHRONIZED_COLLECTION_ITERATORS" + category="CORRECTNESS" /> + <BugPattern abbrev="CC" type="CC_CYCLOMATIC_COMPLEXITY" + category="STYLE" /> + <BugPattern abbrev="OCP" type="OCP_OVERLY_CONCRETE_PARAMETER" + category="STYLE" /> + <BugPattern abbrev="LII" type="LII_LIST_INDEXED_ITERATING" + category="STYLE" /> + <BugPattern abbrev="UCC" type="UCC_UNRELATED_COLLECTION_CONTENTS" + category="STYLE" /> + <BugPattern abbrev="DRE" type="DRE_DECLARED_RUNTIME_EXCEPTION" + category="STYLE" /> + <BugPattern abbrev="CE" type="CE_CLASS_ENVY" category="STYLE" + experimental="true" /> + <BugPattern abbrev="LSC" type="LSC_LITERAL_STRING_COMPARISON" + category="STYLE" /> + <BugPattern abbrev="PCOA" + type="PCOA_PARTIALLY_CONSTRUCTED_OBJECT_ACCESS" category="CORRECTNESS" /> + <BugPattern abbrev="DLC" type="DLC_DUBIOUS_LIST_COLLECTION" + category="PERFORMANCE" /> + <BugPattern abbrev="PL" type="PL_PARALLEL_LISTS" category="STYLE" /> + <BugPattern abbrev="FP" type="FP_FINAL_PARAMETERS" category="STYLE" /> + <BugPattern abbrev="ACEM" type="ACEM_ABSTRACT_CLASS_EMPTY_METHODS" + category="STYLE" /> + <BugPattern abbrev="MAC" type="MAC_MANUAL_ARRAY_COPY" + category="PERFORMANCE" /> + <BugPattern abbrev="FPL" type="FPL_FLOATING_POINT_LOOPS" + category="CORRECTNESS" /> + <BugPattern abbrev="NCMU" type="NCMU_NON_COLLECTION_METHOD_USE" + category="STYLE" /> + <BugPattern abbrev="CAO" type="CAO_CONFUSING_AUTOBOXED_OVERLOADING" + category="CORRECTNESS" /> + <BugPattern abbrev="AFBR" type="AFBR_ABNORMAL_FINALLY_BLOCK_RETURN" + category="CORRECTNESS" /> + <BugPattern abbrev="SMII" type="SMII_STATIC_METHOD_INSTANCE_INVOCATION" + category="STYLE" /> + <BugPattern abbrev="STS" type="STS_SPURIOUS_THREAD_STATES" + category="MT_CORRECTNESS" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING_CTOR" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_STRING_CTOR" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_AUTOBOXING_VALUEOF" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_PARSE" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOXING_VALUEOF" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_UNBOX" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" type="NAB_NEEDLESS_BOX_TO_CAST" + category="PERFORMANCE" /> + <BugPattern abbrev="NAB" + type="NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION" category="PERFORMANCE" /> + <BugPattern abbrev="USBR" type="USBR_UNNECESSARY_STORE_BEFORE_RETURN" + category="STYLE" /> + <BugPattern abbrev="COM" type="COM_COPIED_OVERRIDDEN_METHOD" + category="STYLE" /> + <BugPattern abbrev="ABC" type="ABC_ARRAY_BASED_COLLECTIONS" + category="CORRECTNESS" /> + <BugPattern abbrev="ODN" type="ODN_ORPHANED_DOM_NODE" + category="CORRECTNESS" /> + <BugPattern abbrev="AOM" type="AOM_ABSTRACT_OVERRIDDEN_METHOD" + category="CORRECTNESS" /> + <BugPattern abbrev="CBX" type="CBX_CUSTOM_BUILT_XML" + category="STYLE" /> + <BugPattern abbrev="BSB" type="BSB_BLOATED_SYNCHRONIZED_BLOCK" + category="PERFORMANCE" experimental="true" /> + <BugPattern abbrev="CLI" type="CLI_CONSTANT_LIST_INDEX" + category="CORRECTNESS" /> + <BugPattern abbrev="SCR" type="SCR_SLOPPY_CLASS_REFLECTION" + category="STYLE" /> + <BugPattern abbrev="AWCBR" type="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" + category="STYLE" /> <BugPattern abbrev="SG" type="SG_SLUGGISH_GUI" category="PERFORMANCE" /> - <BugPattern abbrev="NIR" type="NIR_NEEDLESS_INSTANCE_RETRIEVAL" category="PERFORMANCE" /> - <BugPattern abbrev="DDC" type="DDC_DOUBLE_DATE_COMPARISON" category="PERFORMANCE" /> - <BugPattern abbrev="SWCO" type="SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT" category="CORRECTNESS" /> - <BugPattern abbrev="JVR" type="JVR_JDBC_VENDOR_RELIANCE" category="CORRECTNESS" /> - <BugPattern abbrev="PMB" type="PMB_POSSIBLE_MEMORY_BLOAT" category="CORRECTNESS" /> - <BugPattern abbrev="LSYC" type="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" category="CORRECTNESS" /> - <BugPattern abbrev="FCBL" type="FCBL_FIELD_COULD_BE_LOCAL" category="CORRECTNESS" /> - <BugPattern abbrev="NOS" type="NOS_NON_OWNED_SYNCHRONIZATION" category="STYLE" /> - <BugPattern abbrev="NRTL" type="NRTL_NON_RECYCLEABLE_TAG_LIB" category="CORRECTNESS" /> - <BugPattern abbrev="S508C" type="S508C_NULL_LAYOUT" category="CORRECTNESS" /> - <BugPattern abbrev="S508C" type="S508C_NO_SETLABELFOR" category="CORRECTNESS" /> + <BugPattern abbrev="NIR" type="NIR_NEEDLESS_INSTANCE_RETRIEVAL" + category="PERFORMANCE" /> + <BugPattern abbrev="DDC" type="DDC_DOUBLE_DATE_COMPARISON" + category="PERFORMANCE" /> + <BugPattern abbrev="SWCO" + type="SWCO_SUSPICIOUS_WAIT_ON_CONCURRENT_OBJECT" category="CORRECTNESS" /> + <BugPattern abbrev="JVR" type="JVR_JDBC_VENDOR_RELIANCE" + category="CORRECTNESS" /> + <BugPattern abbrev="PMB" type="PMB_POSSIBLE_MEMORY_BLOAT" + category="CORRECTNESS" /> + <BugPattern abbrev="LSYC" type="LSYC_LOCAL_SYNCHRONIZED_COLLECTION" + category="CORRECTNESS" /> + <BugPattern abbrev="FCBL" type="FCBL_FIELD_COULD_BE_LOCAL" + category="CORRECTNESS" /> + <BugPattern abbrev="NOS" type="NOS_NON_OWNED_SYNCHRONIZATION" + category="STYLE" /> + <BugPattern abbrev="NRTL" type="NRTL_NON_RECYCLEABLE_TAG_LIB" + category="CORRECTNESS" /> + <BugPattern abbrev="S508C" type="S508C_NULL_LAYOUT" + category="CORRECTNESS" /> + <BugPattern abbrev="S508C" type="S508C_NO_SETLABELFOR" + category="CORRECTNESS" /> <BugPattern abbrev="S508C" type="S508C_NO_SETSIZE" category="CORRECTNESS" /> - <BugPattern abbrev="S508C" type="S508C_NON_ACCESSIBLE_JCOMPONENT" category="CORRECTNESS" /> - <BugPattern abbrev="S508C" type="S508C_SET_COMP_COLOR" category="CORRECTNESS" /> - <BugPattern abbrev="UEC" type="UEC_USE_ENUM_COLLECTIONS" category="PERFORMANCE" /> + <BugPattern abbrev="S508C" type="S508C_NON_ACCESSIBLE_JCOMPONENT" + category="CORRECTNESS" /> + <BugPattern abbrev="S508C" type="S508C_SET_COMP_COLOR" + category="CORRECTNESS" /> + <BugPattern abbrev="UEC" type="UEC_USE_ENUM_COLLECTIONS" + category="PERFORMANCE" /> <BugPattern abbrev="SIL" type="SIL_SQL_IN_LOOP" category="PERFORMANCE" /> - <BugPattern abbrev="NMCS" type="NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION" category="PERFORMANCE" /> - <BugPattern abbrev="ITC" type="ITC_INHERITANCE_TYPE_CHECKING" category="STYLE" /> - <BugPattern abbrev="SACM" type="SACM_STATIC_ARRAY_CREATED_IN_METHOD" category="PERFORMANCE" /> - <BugPattern abbrev="PRMC" type="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" category="PERFORMANCE" /> + <BugPattern abbrev="NMCS" + type="NMCS_NEEDLESS_MEMBER_COLLECTION_SYNCHRONIZATION" category="PERFORMANCE" /> + <BugPattern abbrev="ITC" type="ITC_INHERITANCE_TYPE_CHECKING" + category="STYLE" /> + <BugPattern abbrev="SACM" type="SACM_STATIC_ARRAY_CREATED_IN_METHOD" + category="PERFORMANCE" /> + <BugPattern abbrev="PRMC" type="PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" + category="PERFORMANCE" /> <BugPattern abbrev="UTA" type="UTA_USE_TO_ARRAY" category="STYLE" /> - <BugPattern abbrev="LEST" type="LEST_LOST_EXCEPTION_STACK_TRACE" category="CORRECTNESS" /> - <BugPattern abbrev="UCPM" type="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" category="PERFORMANCE" /> + <BugPattern abbrev="LEST" type="LEST_LOST_EXCEPTION_STACK_TRACE" + category="CORRECTNESS" /> + <BugPattern abbrev="UCPM" type="UCPM_USE_CHARACTER_PARAMETERIZED_METHOD" + category="PERFORMANCE" /> <BugPattern abbrev="TR" type="TR_TAIL_RECURSION" category="PERFORMANCE" /> - <BugPattern abbrev="URV" type="URV_UNRELATED_RETURN_VALUES" category="STYLE" /> - <BugPattern abbrev="URV" type="URV_CHANGE_RETURN_TYPE" category="STYLE" /> - <BugPattern abbrev="URV" type="URV_INHERITED_METHOD_WITH_RELATED_TYPES" category="STYLE" /> - <BugPattern abbrev="PIS" type="PIS_POSSIBLE_INCOMPLETE_SERIALIZATION" category="CORRECTNESS" /> - <BugPattern abbrev="SCRV" type="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_NEGATIVE_BITSET_ITEM" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_INTERN_ON_CONSTANT" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_NO_CHAR_SB_CTOR" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_USE_MATH_CONSTANT" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_STUTTERED_ASSIGNMENT" category="CORRECTNESS" /> + <BugPattern abbrev="URV" type="URV_UNRELATED_RETURN_VALUES" + category="STYLE" /> + <BugPattern abbrev="URV" type="URV_CHANGE_RETURN_TYPE" + category="STYLE" /> + <BugPattern abbrev="URV" type="URV_INHERITED_METHOD_WITH_RELATED_TYPES" + category="STYLE" /> + <BugPattern abbrev="PIS" type="PIS_POSSIBLE_INCOMPLETE_SERIALIZATION" + category="CORRECTNESS" /> + <BugPattern abbrev="SCRV" type="SC_SUSPICIOUS_COMPARATOR_RETURN_VALUES" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_NEGATIVE_BITSET_ITEM" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_INTERN_ON_CONSTANT" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_NO_CHAR_SB_CTOR" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_USE_MATH_CONSTANT" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_STUTTERED_ASSIGNMENT" + category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_USE_ISNAN" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_USE_BIGDECIMAL_STRING_CTOR" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_STRINGBUFFER_WITH_EMPTY_STRING" category="PERFORMANCE" /> + <BugPattern abbrev="SPP" type="SPP_USE_BIGDECIMAL_STRING_CTOR" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_STRINGBUFFER_WITH_EMPTY_STRING" + category="PERFORMANCE" /> <BugPattern abbrev="SPP" type="SPP_EQUALS_ON_ENUM" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_INVALID_BOOLEAN_NULL_CHECK" category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_INVALID_BOOLEAN_NULL_CHECK" + category="CORRECTNESS" /> <BugPattern abbrev="SPP" type="SPP_USE_CHARAT" category="PERFORMANCE" /> - <BugPattern abbrev="SPP" type="SPP_USELESS_TRINARY" category="PERFORMANCE" /> - <BugPattern abbrev="SPP" type="SPP_SUSPECT_STRING_TEST" category="CORRECTNESS" /> - <BugPattern abbrev="SPP" type="SPP_USE_STRINGBUILDER_LENGTH" category="PERFORMANCE" /> - <BugPattern abbrev="SPP" type="SPP_INVALID_CALENDAR_COMPARE" category="CORRECTNESS"/> - <BugPattern abbrev="SPP" type="SPP_USE_CONTAINSKEY" category="STYLE"/> - <BugPattern abbrev="SPP" type="SPP_USE_ISEMPTY" category="STYLE"/> - <BugPattern abbrev="SPP" type="SPP_USE_GETPROPERTY" category="STYLE"/> - <BugPattern abbrev="SPP" type="SPP_USELESS_CASING" category="PERFORMANCE" experimental="true"/> - <BugPattern abbrev="SPP" type="SPP_SERIALVER_SHOULD_BE_PRIVATE" 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="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" /> - <BugPattern abbrev="SJVU" type="SJVU_SUSPICIOUS_JDK_VERSION_USE" category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_USELESS_TRINARY" + category="PERFORMANCE" /> + <BugPattern abbrev="SPP" type="SPP_SUSPECT_STRING_TEST" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_USE_STRINGBUILDER_LENGTH" + category="PERFORMANCE" /> + <BugPattern abbrev="SPP" type="SPP_INVALID_CALENDAR_COMPARE" + category="CORRECTNESS" /> + <BugPattern abbrev="SPP" type="SPP_USE_CONTAINSKEY" + category="STYLE" /> + <BugPattern abbrev="SPP" type="SPP_USE_ISEMPTY" category="STYLE" /> + <BugPattern abbrev="SPP" type="SPP_USE_GETPROPERTY" + category="STYLE" /> + <BugPattern abbrev="SPP" type="SPP_USELESS_CASING" category="PERFORMANCE" + experimental="true" /> + <BugPattern abbrev="SPP" type="SPP_SERIALVER_SHOULD_BE_PRIVATE" + 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="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" /> + <BugPattern abbrev="SJVU" type="SJVU_SUSPICIOUS_JDK_VERSION_USE" + category="CORRECTNESS" /> <BugPattern abbrev="UAA" type="UAA_USE_ADD_ALL" category="STYLE" /> - <BugPattern abbrev="MRC" type="MRC_METHOD_RETURNS_CONSTANT" category="STYLE" /> - <BugPattern abbrev="NCS" type="NCS_NEEDLESS_CUSTOM_SERIALIZATION" category="CORRECTNESS" /> - <BugPattern abbrev="MOM" type="MOM_MISLEADING_OVERLOAD_MODEL" category="STYLE" /> - <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS" category="STYLE" /> - <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_HAS_CHECKED" category="STYLE" /> - <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CHECKED" category="STYLE" /> - <BugPattern abbrev="CFS" type="CFS_CONFUSING_FUNCTION_SEMANTICS" category="STYLE" /> - <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT" category="STYLE" /> - <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE" category="STYLE" /> - <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT" category="STYLE" /> - <BugPattern abbrev="JAO" type="JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" /> - <BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" category="CORRECTNESS" /> - <BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" category="STYLE" /> - <BugPattern abbrev="SCSS" type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" /> - <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" category="CORRECTNESS" /> - <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_PARAMETER" category="CORRECTNESS" /> - <BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" category="CORRECTNESS" /> - <BugPattern abbrev="DSOC" type="DSOC_DUBIOUS_SET_OF_COLLECTIONS" category="PERFORMANCE" /> - <BugPattern abbrev="BED" type="BED_BOGUS_EXCEPTION_DECLARATION" category="CORRECTNESS" /> - <BugPattern abbrev="UNNC" type="UNNC_UNNECESSARY_NEW_NULL_CHECK" category="CORRECTNESS" /> - <BugPattern abbrev="DTEP" type="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" category="STYLE" /> - <BugPattern abbrev="SMA" type="SMA_STUTTERED_METHOD_ARGUMENTS" category="STYLE" /> - <BugPattern abbrev="TBP" type="TBP_TRISTATE_BOOLEAN_PATTERN" category="STYLE" /> - <BugPattern abbrev="SUA" type="SUA_SUSPICIOUS_UNINITIALIZED_ARRAY" category="CORRECTNESS" /> - <BugPattern abbrev="ITU" type="ITU_INAPPROPRIATE_TOSTRING_USE" category="CORRECTNESS" /> - <BugPattern abbrev="IKNC" type="IKNC_INCONSISTENT_HTTP_PARAM_CASING" category="STYLE" experimental="true" /> - <BugPattern abbrev="OC" type="OC_OVERZEALOUS_CASTING" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="PDP" type="PDP_POORLY_DEFINED_PARAMETER" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="NSE" type="NSE_NON_SYMMETRIC_EQUALS" category="CORRECTNESS" experimental="true" /> - <BugPattern abbrev="CVAA" type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" category="CORRECTNESS" experimental="true"/> - <BugPattern abbrev="NFF" type="NFF_NON_FUNCTIONAL_FIELD" category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="MRC" type="MRC_METHOD_RETURNS_CONSTANT" + category="STYLE" /> + <BugPattern abbrev="NCS" type="NCS_NEEDLESS_CUSTOM_SERIALIZATION" + category="CORRECTNESS" /> + <BugPattern abbrev="MOM" type="MOM_MISLEADING_OVERLOAD_MODEL" + category="STYLE" /> + <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CONSTRAINTS" + category="STYLE" /> + <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_HAS_CHECKED" + category="STYLE" /> + <BugPattern abbrev="EXS" type="EXS_EXCEPTION_SOFTENING_NO_CHECKED" + category="STYLE" /> + <BugPattern abbrev="CFS" type="CFS_CONFUSING_FUNCTION_SEMANTICS" + category="STYLE" /> + <BugPattern abbrev="JAO" + type="JAO_JUNIT_ASSERTION_ODDITIES_ACTUAL_CONSTANT" category="STYLE" /> + <BugPattern abbrev="JAO" + type="JAO_JUNIT_ASSERTION_ODDITIES_INEXACT_DOUBLE" category="STYLE" /> + <BugPattern abbrev="JAO" + type="JAO_JUNIT_ASSERTION_ODDITIES_BOOLEAN_ASSERT" category="STYLE" /> + <BugPattern abbrev="JAO" + type="JAO_JUNIT_ASSERTION_ODDITIES_IMPOSSIBLE_NULL" category="CORRECTNESS" /> + <BugPattern abbrev="SCA" type="SCA_SUSPICIOUS_CLONE_ALGORITHM" + category="CORRECTNESS" /> + <BugPattern abbrev="WEM" type="WEM_WEAK_EXCEPTION_MESSAGING" + category="STYLE" /> + <BugPattern abbrev="SCSS" + type="SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT" category="CORRECTNESS" /> + <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_CLASS" + category="CORRECTNESS" /> + <BugPattern abbrev="LO" type="LO_SUSPECT_LOG_PARAMETER" + category="CORRECTNESS" /> + <BugPattern abbrev="IICU" type="IICU_INCORRECT_INTERNAL_CLASS_USE" + category="CORRECTNESS" /> + <BugPattern abbrev="DSOC" type="DSOC_DUBIOUS_SET_OF_COLLECTIONS" + category="PERFORMANCE" /> + <BugPattern abbrev="BED" type="BED_BOGUS_EXCEPTION_DECLARATION" + category="CORRECTNESS" /> + <BugPattern abbrev="UNNC" type="UNNC_UNNECESSARY_NEW_NULL_CHECK" + category="CORRECTNESS" /> + <BugPattern abbrev="DTEP" type="DTEP_DEPRECATED_TYPESAFE_ENUM_PATTERN" + category="STYLE" /> + <BugPattern abbrev="SMA" type="SMA_STUTTERED_METHOD_ARGUMENTS" + category="STYLE" /> + <BugPattern abbrev="TBP" type="TBP_TRISTATE_BOOLEAN_PATTERN" + category="STYLE" /> + <BugPattern abbrev="SUA" type="SUA_SUSPICIOUS_UNINITIALIZED_ARRAY" + category="CORRECTNESS" /> + <BugPattern abbrev="ITU" type="ITU_INAPPROPRIATE_TOSTRING_USE" + category="CORRECTNESS" /> + <BugPattern abbrev="IKNC" type="IKNC_INCONSISTENT_HTTP_PARAM_CASING" + category="STYLE" experimental="true" /> + <BugPattern abbrev="OC" type="OC_OVERZEALOUS_CASTING" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="PDP" type="PDP_POORLY_DEFINED_PARAMETER" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="NSE" type="NSE_NON_SYMMETRIC_EQUALS" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="CVAA" type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="NFF" type="NFF_NON_FUNCTIONAL_FIELD" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="WNG" type="WNG_WRONG_NULL_FIELD_GUARD" + category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="WNG" type="WNG_WRONG_NULL_LOCAL_GUARD" + category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-11-26 03:25:08 UTC (rev 1390) +++ trunk/fb-contrib/etc/messages.xml 2009-12-19 18:05:32 UTC (rev 1391) @@ -1048,35 +1048,48 @@ </Details> </Detector> - <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment"> - <Details> - <![CDATA[ - <p>Finds contravariant array assignments. Since arrays are mutable data structures, their use - must be restricted to covariant or invariant usage</p> - - <pre> - class A {} - class B extends A {} - - B[] b = new B[2]; - A[] a = b; - a[0] = new A(); // results in ArrayStoreException (Runtime) - </pre> - <p>It is a fast detector</p> - ]]> - </Details> - </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment"> + <Details> + <![CDATA[ + <p>Finds contravariant array assignments. Since arrays are mutable data structures, their use + must be restricted to covariant or invariant usage</p> + + <pre> + class A {} + class B extends A {} + + B[] b = new B[2]; + A[] a = b; + a[0] = new A(); // results in ArrayStoreException (Runtime) + </pre> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> - <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField"> - <Details> - <![CDATA[ - <p>looks for fields in serializable classes that are defined as both final and + <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField"> + <Details> + <![CDATA[ + <p>looks for fields in serializable classes that are defined as both final and transient. As a transient field is not initialized when streamed, and is not initialized in a constructor, it will remain null because it is defined final.</p> <p>It is a fast detector</p> ]]> - </Details> - </Detector> + </Details> + </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.WrongNullGuard"> + <Details> + <![CDATA[ + <p>looks for code that checks to see if a field or local variable is not null, + before entering a code block either an if, or while statement, and then doesn't + reference that field or local in the block of code that is guarded by the null + check. It is likely that null check is being done on the wrong variable, either + because of a copy/paste error, or a change in implementation.</p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> <!-- BugPattern --> @@ -2736,40 +2749,65 @@ </Details> </BugPattern> - <BugPattern type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT"> - <ShortDescription>method performs a contravariant array assignment</ShortDescription> - <LongDescription>method {1} performs a contravariant array assignment</LongDescription> - <Details> - <![CDATA[ - <p>this method contains a contravariant array assignment. Since arrays are mutable data structures, their use - must be restricted to covariant or invariant usage</p> - - <pre> - class A {} - class B extends A {} - - B[] b = new B[2]; - A[] a = b; - a[0] = new A(); // results in ArrayStoreException (Runtime) - </pre> - <p>It is a fast detector</p> - ]]> - </Details> - </BugPattern> + <BugPattern type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT"> + <ShortDescription>method performs a contravariant array assignment</ShortDescription> + <LongDescription>method {1} performs a contravariant array assignment</LongDescription> + <Details> + <![CDATA[ + <p>This method contains a contravariant array assignment. Since arrays are mutable data structures, their use + must be restricted to covariant or invariant usage</p> + + <pre> + class A {} + class B extends A {} + + B[] b = new B[2]; + A[] a = b; + a[0] = new A(); // results in ArrayStoreException (Runtime) + </pre> + <p>It is a fast detector</p> + ]]> + </Details> + </BugPattern> - <BugPattern type="NFF_NON_FUNCTIONAL_FIELD"> - <ShortDescription>serializable class defines a final transient field</ShortDescription> - <LongDescription>serializable class {0} defines a final transient field</LongDescription> - <Details> - <![CDATA[ - <p>this serializable class defines a field as both transient and final. As transient fields - are not serialized across the stream, it is required that some piece of code reinitialize that field - when it is deserialized. But since constructors aren't called when deserialization, the field is not initialized. - And since the field is final, no other method can initialize it as well.</p> - ]]> - </Details> - </BugPattern> + <BugPattern type="NFF_NON_FUNCTIONAL_FIELD"> + <ShortDescription>serializable class defines a final transient field</ShortDescription> + <LongDescription>serializable class {0} defines a final transient field</LongDescription> + <Details> + <![CDATA[ + <p>This serializable class defines a field as both transient and final. As transient fields + are not serialized across the stream, it is required that some piece of code reinitialize that field + when it is deserialized. But since constructors aren't called when deserialization, the field is not initialized. + And since the field is final, no other method can initialize it as well.</p> + ]]> + </Details> + </BugPattern> + <BugPattern type="WNG_WRONG_NULL_FIELD_GUARD"> + <ShortDescription>method tests a field for null as guard for code that doesn't use it</ShortDescription> + <LongDescription>method {1} tests a field for null as guard for code that doesn't use it</LongDescription> + <Details> + <![CDATA[ + <p>This method tests a field to make sure it's not null before executing a conditional block of + code. However, it does not appear that this block of code relies on the field in question, so the + choice of null guard seems dubious. It is possible that the code block calls a method that requires + this field not to be null, but that would seem like an odd construct.</p> + ]]> + </Details> + </BugPattern> + + <BugPattern type="WNG_WRONG_NULL_LOCAL_GUARD"> + <ShortDescription>method tests a local variable for null as guard for code that doesn't use it</ShortDescription> + <LongDescription>method {1} tests a local variable for null as guard for code that doesn't use it</LongDescription> + <Details> + <![CDATA[ + <p>This method tests a local variable to make sure it's not null before executing a conditional block of + code. However, this block of does not access the local variable in question, so the + choice of null guard seems wrong. Perhaps this is a copy/paste mistake.</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2858,6 +2896,7 @@ <BugCode abbrev="OC">Overzealous Casting</BugCode> <BugCode abbrev="PDP">Poorly Defined Parameter</BugCode> <BugCode abbrev="NSE">Non Symmetric Equals</BugCode> - <BugCode abbrev="CVAA">Contravariant Array Assignment</BugCode> - <BugCode abbrev="NFF">Non Functional Field</BugCode> + <BugCode abbrev="CVAA">Contravariant Array Assignment</BugCode> + <BugCode abbrev="NFF">Non Functional Field</BugCode> + <BugCode abbrev="WNG">Wrong Null Guard</BugCode> </MessageCollection> \ No newline at end of file Added: trunk/fb-contrib/samples/WNG_Sample.java =================================================================== --- trunk/fb-contrib/samples/WNG_Sample.java (rev 0) +++ trunk/fb-contrib/samples/WNG_Sample.java 2009-12-19 18:05:32 UTC (rev 1391) @@ -0,0 +1,22 @@ + +public class WNG_Sample +{ + private Object f1 = null; + private Object f2 = null; + + public String badWNGFields() + { + if (f1 != null) + return f2.toString(); + + return null; + } + + public String badWNGLocals(Object l1, Object l2) + { + if (l1 != null) + return l2.toString(); + + return null; + } +} Property changes on: trunk/fb-contrib/samples/WNG_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2009-12-19 18:05:32 UTC (rev 1391) @@ -0,0 +1,183 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2009 Dave Brosius + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.mebigfatguy.fbcontrib.detect; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.bcel.classfile.Code; + +import com.mebigfatguy.fbcontrib.utils.Integer14; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.BytecodeScanningDetector; +import edu.umd.cs.findbugs.OpcodeStack; +import edu.umd.cs.findbugs.ba.ClassContext; +import edu.umd.cs.findbugs.ba.XField; + +/** + * looks for code that checks to see if a field or local variable is not null, + * before entering a code block ... [truncated message content] |
From: <dbr...@us...> - 2009-11-26 03:25:15
|
Revision: 1390 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1390&view=rev Author: dbrosius Date: 2009-11-26 03:25:08 +0000 (Thu, 26 Nov 2009) Log Message: ----------- javadoc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2009-11-26 03:24:32 UTC (rev 1389) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NeedlessMemberCollectionSynchronization.java 2009-11-26 03:25:08 UTC (rev 1390) @@ -382,8 +382,6 @@ /** * removes collection fields that are passed to other methods as arguments - * - * @param seen the opcode of the currently parsed instruction */ private void removeCollectionParameters() { int parmCount = Type.getArgumentTypes(getSigConstantOperand()).length; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-26 03:24:38
|
Revision: 1389 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1389&view=rev Author: dbrosius Date: 2009-11-26 03:24:32 +0000 (Thu, 26 Nov 2009) Log Message: ----------- javadoc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java 2009-11-26 03:24:04 UTC (rev 1388) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UseCharacterParameterizedMethod.java 2009-11-26 03:24:32 UTC (rev 1389) @@ -89,7 +89,7 @@ /** * looks for methods that contain a LDC opcode * - * @param method the context object of the current method + * @param obj the context object of the current method * @return if the class uses LDC instructions */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-26 03:24:10
|
Revision: 1388 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1388&view=rev Author: dbrosius Date: 2009-11-26 03:24:04 +0000 (Thu, 26 Nov 2009) Log Message: ----------- javadoc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2009-11-26 03:23:30 UTC (rev 1387) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ExceptionSoftening.java 2009-11-26 03:24:04 UTC (rev 1388) @@ -251,7 +251,7 @@ /** remove catchinfo blocks from the map where the handler end is before the current pc * - * @param handlers the exception handlers installed + * @param catchInfos the exception handlers installed * @param pc the current pc */ private void removeFinishedCatchBlocks(List<CatchInfo> catchInfos, int pc) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-26 03:23:39
|
Revision: 1387 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1387&view=rev Author: dbrosius Date: 2009-11-26 03:23:30 +0000 (Thu, 26 Nov 2009) Log Message: ----------- javadoc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-11-26 03:23:03 UTC (rev 1386) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java 2009-11-26 03:23:30 UTC (rev 1387) @@ -332,7 +332,7 @@ /** returns whether the class in question was compiled with a jdk less than 1.4 * - * @param exClass the class to check + * @param cls the class to check * @return whether the class is compiled with a jdk less than 1.4 */ private boolean isPre14Class(JavaClass cls) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-26 03:23:14
|
Revision: 1386 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1386&view=rev Author: dbrosius Date: 2009-11-26 03:23:03 +0000 (Thu, 26 Nov 2009) Log Message: ----------- javadoc Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2009-11-14 20:07:23 UTC (rev 1385) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java 2009-11-26 03:23:03 UTC (rev 1386) @@ -626,7 +626,7 @@ /** * adds a scope block to this subtree by finding the correct place in the hierarchy to store it * - * @param child the scope block to add to the tree + * @param newChild the scope block to add to the tree */ public void addChild(ScopeBlock newChild) { newChild.parent = this; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-14 20:07:31
|
Revision: 1385 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1385&view=rev Author: dbrosius Date: 2009-11-14 20:07:23 +0000 (Sat, 14 Nov 2009) Log Message: ----------- better engrish Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-11-13 14:07:50 UTC (rev 1384) +++ trunk/fb-contrib/etc/messages.xml 2009-11-14 20:07:23 UTC (rev 1385) @@ -2585,12 +2585,12 @@ <LongDescription>method {1} uses a set of collections</LongDescription> <Details> <![CDATA[ - <p>This method creates a set that contains other collections, or a Map who's keySet is + <p>This method creates a set that contains other collections, or a Map whose keySet is another collection. As collections tend to calculate hashCode, equals and compareTo by iterating the contents of the collection, this can perform poorly.</p> - <p>In addition, when a set is used, you typically are using it to do contains, or find - type functionality, which seems dubious when do so on a collection</p> - <p>Finally, As a collection is often modified, problems will occur if the collection is + <p>In addition, when a set is used, you typically are using it to do 'contains', or 'find' + type functionality, which seems dubious when done on a collection</p> + <p>Finally, as a collection is often modified, problems will occur if the collection is contained in a set, because the hashCode, equals or compareTo values will change while the collection is in the set</p> <p>If you wish to maintain a collection of collections, it is probably better to use a List This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-13 14:08:05
|
Revision: 1384 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1384&view=rev Author: dbrosius Date: 2009-11-13 14:07:50 +0000 (Fri, 13 Nov 2009) Log Message: ----------- add new patterns Modified Paths: -------------- trunk/fb-contrib/etc/bugrank.txt Modified: trunk/fb-contrib/etc/bugrank.txt =================================================================== --- trunk/fb-contrib/etc/bugrank.txt 2009-11-13 14:02:42 UTC (rev 1383) +++ trunk/fb-contrib/etc/bugrank.txt 2009-11-13 14:07:50 UTC (rev 1384) @@ -123,4 +123,6 @@ 0 BugPattern IKNC_INCONSISTENT_HTTP_PARAM_CASING 0 BugPattern OC_OVERZEALOUS_CASTING 0 BugPattern PDP_POORLY_DEFINED_PARAMETER -0 BugPattern NSE_NON_SYMMETRIC_EQUALS \ No newline at end of file +0 BugPattern NSE_NON_SYMMETRIC_EQUALS +0 BugPattern CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT +0 BugPattern NFF_NON_FUNCTIONAL_FIELD \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-13 14:03:01
|
Revision: 1383 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1383&view=rev Author: dbrosius Date: 2009-11-13 14:02:42 +0000 (Fri, 13 Nov 2009) Log Message: ----------- make sure dottedClassName is set Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2009-11-12 05:13:43 UTC (rev 1382) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2009-11-13 14:02:42 UTC (rev 1383) @@ -67,6 +67,7 @@ JavaClass cls = classContext.getJavaClass(); if ((serializableClass != null) && (cls.implementationOf(serializableClass))) { Field[] fields = cls.getFields(); + setupVisitorForClass(cls); for (Field f : fields) { if (f.isFinal() && f.isTransient()) { bugReporter.reportBug(new BugInstance(this, "NFF_NON_FUNCTIONAL_FIELD", Priorities.NORMAL_PRIORITY) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-11-12 05:13:51
|
Revision: 1382 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1382&view=rev Author: dbrosius Date: 2009-11-12 05:13:43 +0000 (Thu, 12 Nov 2009) Log Message: ----------- add NFF detector Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml trunk/fb-contrib/etc/messages.xml Added Paths: ----------- trunk/fb-contrib/samples/NFF_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-11-12 03:35:19 UTC (rev 1381) +++ trunk/fb-contrib/etc/findbugs.xml 2009-11-12 05:13:43 UTC (rev 1382) @@ -381,6 +381,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" speed="fast" reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField" + speed="fast" + reports="NFF_NON_FUNCTIONAL_FIELD" /> <!-- BugPattern --> @@ -511,4 +515,5 @@ <BugPattern abbrev="PDP" type="PDP_POORLY_DEFINED_PARAMETER" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="NSE" type="NSE_NON_SYMMETRIC_EQUALS" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="CVAA" type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" category="CORRECTNESS" experimental="true"/> + <BugPattern abbrev="NFF" type="NFF_NON_FUNCTIONAL_FIELD" category="CORRECTNESS" experimental="true" /> </FindbugsPlugin> \ No newline at end of file Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-11-12 03:35:19 UTC (rev 1381) +++ trunk/fb-contrib/etc/messages.xml 2009-11-12 05:13:43 UTC (rev 1382) @@ -1066,6 +1066,17 @@ ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField"> + <Details> + <![CDATA[ + <p>looks for fields in serializable classes that are defined as both final and + transient. As a transient field is not initialized when streamed, and is not + initialized in a constructor, it will remain null because it is defined final.</p> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> <!-- BugPattern --> @@ -2730,7 +2741,7 @@ <LongDescription>method {1} performs a contravariant array assignment</LongDescription> <Details> <![CDATA[ - <p>Finds contravariant array assignments. Since arrays are mutable data structures, their use + <p>this method contains a contravariant array assignment. Since arrays are mutable data structures, their use must be restricted to covariant or invariant usage</p> <pre> @@ -2746,6 +2757,19 @@ </Details> </BugPattern> + <BugPattern type="NFF_NON_FUNCTIONAL_FIELD"> + <ShortDescription>serializable class defines a final transient field</ShortDescription> + <LongDescription>serializable class {0} defines a final transient field</LongDescription> + <Details> + <![CDATA[ + <p>this serializable class defines a field as both transient and final. As transient fields + are not serialized across the stream, it is required that some piece of code reinitialize that field + when it is deserialized. But since constructors aren't called when deserialization, the field is not initialized. + And since the field is final, no other method can initialize it as well.</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2835,4 +2859,5 @@ <BugCode abbrev="PDP">Poorly Defined Parameter</BugCode> <BugCode abbrev="NSE">Non Symmetric Equals</BugCode> <BugCode abbrev="CVAA">Contravariant Array Assignment</BugCode> + <BugCode abbrev="NFF">Non Functional Field</BugCode> </MessageCollection> \ No newline at end of file Added: trunk/fb-contrib/samples/NFF_Sample.java =================================================================== --- trunk/fb-contrib/samples/NFF_Sample.java (rev 0) +++ trunk/fb-contrib/samples/NFF_Sample.java 2009-11-12 05:13:43 UTC (rev 1382) @@ -0,0 +1,8 @@ +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +public class NFF_Sample implements Serializable +{ + private final transient List<String> s = new ArrayList<String>(); +} \ No newline at end of file Property changes on: trunk/fb-contrib/samples/NFF_Sample.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.java 2009-11-12 05:13:43 UTC (rev 1382) @@ -0,0 +1,86 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2005-2009 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.Field; +import org.apache.bcel.classfile.JavaClass; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.Detector; +import edu.umd.cs.findbugs.Priorities; +import edu.umd.cs.findbugs.ba.ClassContext; +import edu.umd.cs.findbugs.visitclass.PreorderVisitor; + +/** + * looks for fields in serializable classes that are defined as both final and + * transient. As a transient field is not initialized when streamed, and is not + * initialized in a constructor, it will remain null because it is defined final. + */ +public class NonFunctionalField extends PreorderVisitor implements Detector { + + private static JavaClass serializableClass; + + static { + try { + serializableClass = Repository.lookupClass("java/io/Serializable"); + } catch (ClassNotFoundException cnfe) { + serializableClass = null; + } + } + + private BugReporter bugReporter; + /** + * constructs a NFF detector given the reporter to report bugs on + * @param bugReporter the sync of bug reports + */ + public NonFunctionalField(BugReporter bugReporter) { + this.bugReporter = bugReporter; + } + + /** + * checks to see if the class is Serializable, then looks for fields + * that are both final and transient + * @param classContext the context object of the currently parsed class + */ + + @Override + public void visitClassContext(ClassContext classContext) { + try { + JavaClass cls = classContext.getJavaClass(); + if ((serializableClass != null) && (cls.implementationOf(serializableClass))) { + Field[] fields = cls.getFields(); + for (Field f : fields) { + if (f.isFinal() && f.isTransient()) { + bugReporter.reportBug(new BugInstance(this, "NFF_NON_FUNCTIONAL_FIELD", Priorities.NORMAL_PRIORITY) + .addClass(this) + .addField(cls.getClassName(), f.getName(), f.getSignature(), f.getAccessFlags())); + } + } + } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); + } + } + + @Override + public void report() { + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/NonFunctionalField.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...> - 2009-11-12 03:35:26
|
Revision: 1381 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1381&view=rev Author: dbrosius Date: 2009-11-12 03:35:19 +0000 (Thu, 12 Nov 2009) Log Message: ----------- latest updates for CVAA from bhaskar Modified Paths: -------------- trunk/fb-contrib/samples/CVAA_Sample.java trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java Modified: trunk/fb-contrib/samples/CVAA_Sample.java =================================================================== --- trunk/fb-contrib/samples/CVAA_Sample.java 2009-10-18 15:33:09 UTC (rev 1380) +++ trunk/fb-contrib/samples/CVAA_Sample.java 2009-11-12 03:35:19 UTC (rev 1381) @@ -2,25 +2,26 @@ public class CVAA_Sample { Base[] b2; - Derived[] d2; class Base {} class Derived extends Base {} public void cvaa() { - Derived[] d = new Derived[2]; - cvaa_invoke(d, 5); - Base[] b = d; - cvaa_invoke(b, 5); - b2 = d; - d2 = d; + Derived[] d2 = new Derived[4]; + Base[] b = d2; + b2 = d2; + Derived d = new Derived(); b[0] = new Base(); + b[1] = doDerived(); + b[2] = null; + b[3] = d; Integer[] a = new Integer[1]; System.arraycopy(a[0], 0, a, 1, 1); } - private void cvaa_invoke(Base[] b, int n){ + private Derived doDerived(){ + return new Derived(); } -} +} \ No newline at end of file Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2009-10-18 15:33:09 UTC (rev 1380) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2009-11-12 03:35:19 UTC (rev 1381) @@ -44,12 +44,14 @@ * 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. * */ public class ContraVariantArrayAssignment extends BytecodeScanningDetector { private final BugReporter bugReporter; private final OpcodeStack stack; - private final boolean checkMethods; /** * constructs a CVAA detector given the reporter to report bugs on. @@ -59,7 +61,6 @@ public ContraVariantArrayAssignment(final BugReporter bugReporter) { this.bugReporter = bugReporter; stack = new OpcodeStack(); - checkMethods = System.getProperty("CCVA_CHECKMETHODS") != null; } /** @@ -88,7 +89,7 @@ case ASTORE_2: case ASTORE_3: if(stack.getStackDepth() > 0){ - OpcodeStack.Item item = stack.getStackItem(0); + OpcodeStack.Item item = stack.getStackItem(0); String sourceSignature = item.getSignature(); LocalVariable lv = getMethod().getLocalVariableTable() .getLocalVariable(RegisterUtils.getAStoreReg(this, seen), getNextPC()); @@ -107,17 +108,31 @@ checkSignatures(sourceSignature, targetSignature); } break; - case INVOKESTATIC: - case INVOKEVIRTUAL: - case INVOKEINTERFACE: - case INVOKESPECIAL: - if(checkMethods && stack.getStackDepth() > 0){ - String signature = getSigConstantOperand(); - checkMethodInvocation(signature); + case AASTORE: + OpcodeStack.Item arrayref = stack.getStackItem(2); + OpcodeStack.Item value = stack.getStackItem(0); + + if(!value.isNull()) { + String sourceSignature = value.getSignature(); + String targetSignature = arrayref.getSignature(); + try{ + if(Type.getType(sourceSignature) instanceof ObjectType ) { + ObjectType sourceType = (ObjectType) Type.getType(sourceSignature); + ObjectType targetType = (ObjectType) ((ArrayType) Type.getType(targetSignature)).getBasicType(); + if(!sourceType.subclassOf(targetType)){ + bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", HIGH_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } catch (ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); + } } - break; + break; } - super.sawOpcode(seen); + super.sawOpcode(seen); } finally{ stack.sawOpcode(this, seen); @@ -144,7 +159,7 @@ if(isObjectType(sourceSignature) && isObjectType(targetSignature)){ ObjectType sourceType = (ObjectType) ((ArrayType) Type.getType(sourceSignature)).getBasicType(); ObjectType targetType = (ObjectType) ((ArrayType) Type.getType(targetSignature)).getBasicType(); - if(sourceType.subclassOf(targetType) && !targetType.subclassOf(sourceType)) { + if(!targetType.subclassOf(sourceType)) { bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", NORMAL_PRIORITY) .addClass(this) .addMethod(this) @@ -152,20 +167,10 @@ } } } - } + } } catch(ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } - - private void checkMethodInvocation(String signature) { - Type[] types = Type.getArgumentTypes(signature); - for(int i = 0; i < types.length; i++){ - String targetSignature = types[i].getSignature(); - OpcodeStack.Item item = stack.getStackItem(types.length - i - 1); - String sourceSignature = item.getSignature(); - checkSignatures(sourceSignature, targetSignature); - } - } -} +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-18 15:33:17
|
Revision: 1380 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1380&view=rev Author: dbrosius Date: 2009-10-18 15:33:09 +0000 (Sun, 18 Oct 2009) Log Message: ----------- more tests Modified Paths: -------------- trunk/fb-contrib/samples/PDP_Sample.java Modified: trunk/fb-contrib/samples/PDP_Sample.java =================================================================== --- trunk/fb-contrib/samples/PDP_Sample.java 2009-10-18 13:57:32 UTC (rev 1379) +++ trunk/fb-contrib/samples/PDP_Sample.java 2009-10-18 15:33:09 UTC (rev 1380) @@ -56,4 +56,22 @@ return s; } + + public String testFPFlimsySwitchGuard(Comparable<?> c, int type) { + String s = c.toString(); + + switch (type) + { + case 0: + Number n = (Number)c; + s += n.intValue(); + break; + + case 1: + s += s; + break; + } + + return s; + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-18 13:57:42
|
Revision: 1379 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1379&view=rev Author: dbrosius Date: 2009-10-18 13:57:32 +0000 (Sun, 18 Oct 2009) Log Message: ----------- Modified Paths: -------------- trunk/fb-contrib/samples/S508C_Sample.java Modified: trunk/fb-contrib/samples/S508C_Sample.java =================================================================== --- trunk/fb-contrib/samples/S508C_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) +++ trunk/fb-contrib/samples/S508C_Sample.java 2009-10-18 13:57:32 UTC (rev 1379) @@ -33,5 +33,5 @@ class MyComponent extends JComponent { - + private static final long serialVersionUID = -628028159110180711L; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-18 13:57:02
|
Revision: 1378 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1378&view=rev Author: dbrosius Date: 2009-10-18 13:56:49 +0000 (Sun, 18 Oct 2009) Log Message: ----------- suppress warnings in samples Modified Paths: -------------- trunk/fb-contrib/samples/AFBR_Sample.java trunk/fb-contrib/samples/BAS_Sample.java trunk/fb-contrib/samples/BED_Sample.java trunk/fb-contrib/samples/BSB_Sample.java trunk/fb-contrib/samples/CLI_Sample.java trunk/fb-contrib/samples/DRE_Sample.java trunk/fb-contrib/samples/EXS_Sample.java trunk/fb-contrib/samples/FCBL_Sample.java trunk/fb-contrib/samples/IICU_Sample.java trunk/fb-contrib/samples/IKNC_Sample.java trunk/fb-contrib/samples/ISB_Sample.java trunk/fb-contrib/samples/ITC_Sample.java trunk/fb-contrib/samples/LEST_Sample.java trunk/fb-contrib/samples/LO_Sample.java trunk/fb-contrib/samples/MRC_Sample.java trunk/fb-contrib/samples/NAB_Sample.java trunk/fb-contrib/samples/NCMU_Sample.java trunk/fb-contrib/samples/NCS_Sample.java trunk/fb-contrib/samples/NIR_Sample.java trunk/fb-contrib/samples/NOS_Sample.java trunk/fb-contrib/samples/NRTL_Sample.java trunk/fb-contrib/samples/OCP_Sample.java trunk/fb-contrib/samples/OC_Sample.java trunk/fb-contrib/samples/ODN_Sample.java trunk/fb-contrib/samples/PDP_Sample.java trunk/fb-contrib/samples/PIS_Sample.java trunk/fb-contrib/samples/PL_Sample.java trunk/fb-contrib/samples/RMC_Sample.java trunk/fb-contrib/samples/S508C_Sample.java trunk/fb-contrib/samples/SCR_Sample.java trunk/fb-contrib/samples/SCSS_Sample.java trunk/fb-contrib/samples/SG_Sample.java trunk/fb-contrib/samples/SIL_Sample.java trunk/fb-contrib/samples/SMII_Sample.java trunk/fb-contrib/samples/SPP_Sample.java trunk/fb-contrib/samples/UEC_Sample.java trunk/fb-contrib/samples/URV_Sample.java trunk/fb-contrib/samples/USBR_Sample.java Modified: trunk/fb-contrib/samples/AFBR_Sample.java =================================================================== --- trunk/fb-contrib/samples/AFBR_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/AFBR_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -2,6 +2,7 @@ import java.io.IOException; import java.io.InputStream; +@SuppressWarnings("all") public class AFBR_Sample { public int test1(boolean b) Modified: trunk/fb-contrib/samples/BAS_Sample.java =================================================================== --- trunk/fb-contrib/samples/BAS_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/BAS_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -2,6 +2,7 @@ import java.util.List; import java.util.Set; +@SuppressWarnings("all") public class BAS_Sample { public void testIfScope(String s) Modified: trunk/fb-contrib/samples/BED_Sample.java =================================================================== --- trunk/fb-contrib/samples/BED_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/BED_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,8 +1,7 @@ +import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.File; -import java.io.IOException; import java.sql.SQLException; import java.util.Hashtable; import java.util.zip.DataFormatException; @@ -12,6 +11,7 @@ import javax.naming.directory.InitialDirContext; +@SuppressWarnings("all") public class BED_Sample { public BED_Sample() throws IOException Modified: trunk/fb-contrib/samples/BSB_Sample.java =================================================================== --- trunk/fb-contrib/samples/BSB_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/BSB_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -5,6 +5,7 @@ import java.util.Map; import java.util.Set; +@SuppressWarnings("all") public class BSB_Sample { private Object lock = new Object(); Modified: trunk/fb-contrib/samples/CLI_Sample.java =================================================================== --- trunk/fb-contrib/samples/CLI_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/CLI_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,4 +1,5 @@ +@SuppressWarnings("all") public class CLI_Sample { public String test1(String[] sa) Modified: trunk/fb-contrib/samples/DRE_Sample.java =================================================================== --- trunk/fb-contrib/samples/DRE_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/DRE_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -2,6 +2,7 @@ import java.sql.SQLException; +@SuppressWarnings("all") public class DRE_Sample { public void test1(int a) throws NullPointerException { @@ -23,6 +24,7 @@ } } +@SuppressWarnings("all") class CustomRuntimeException extends RuntimeException { Modified: trunk/fb-contrib/samples/EXS_Sample.java =================================================================== --- trunk/fb-contrib/samples/EXS_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/EXS_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -4,6 +4,7 @@ import java.sql.SQLException; +@SuppressWarnings("all") public class EXS_Sample extends Super { @Override Modified: trunk/fb-contrib/samples/FCBL_Sample.java =================================================================== --- trunk/fb-contrib/samples/FCBL_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/FCBL_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,4 +1,5 @@ +@SuppressWarnings("all") public final class FCBL_Sample { public int foo; Modified: trunk/fb-contrib/samples/IICU_Sample.java =================================================================== --- trunk/fb-contrib/samples/IICU_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/IICU_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -3,6 +3,7 @@ import com.sun.org.apache.xerces.internal.jaxp.datatype.XMLGregorianCalendarImpl; +@SuppressWarnings("all") public class IICU_Sample { public void test() Modified: trunk/fb-contrib/samples/IKNC_Sample.java =================================================================== --- trunk/fb-contrib/samples/IKNC_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/IKNC_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -2,6 +2,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +@SuppressWarnings("all") public class IKNC_Sample { public void doGet(HttpServletRequest req, HttpServletResponse resp) Modified: trunk/fb-contrib/samples/ISB_Sample.java =================================================================== --- trunk/fb-contrib/samples/ISB_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/ISB_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,5 +1,6 @@ import java.util.Map; +@SuppressWarnings("all") public class ISB_Sample { public String testISB1(String a, String b) Modified: trunk/fb-contrib/samples/ITC_Sample.java =================================================================== --- trunk/fb-contrib/samples/ITC_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/ITC_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -3,6 +3,7 @@ import java.util.List; import java.util.Vector; +@SuppressWarnings("all") public class ITC_Sample { class A Modified: trunk/fb-contrib/samples/LEST_Sample.java =================================================================== --- trunk/fb-contrib/samples/LEST_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/LEST_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -3,6 +3,7 @@ import java.text.SimpleDateFormat; import java.util.Date; +@SuppressWarnings("all") public class LEST_Sample { public Date testLest1(String input) Modified: trunk/fb-contrib/samples/LO_Sample.java =================================================================== --- trunk/fb-contrib/samples/LO_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/LO_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,6 +1,7 @@ import org.apache.log4j.Logger; +@SuppressWarnings("all") public class LO_Sample { private static Logger l1 = Logger.getLogger(String.class); Modified: trunk/fb-contrib/samples/MRC_Sample.java =================================================================== --- trunk/fb-contrib/samples/MRC_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/MRC_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -2,6 +2,7 @@ import java.util.List; +@SuppressWarnings("all") public class MRC_Sample { private int getValue() { Modified: trunk/fb-contrib/samples/NAB_Sample.java =================================================================== --- trunk/fb-contrib/samples/NAB_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/NAB_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,4 +1,5 @@ +@SuppressWarnings("all") public class NAB_Sample { public void testDupCtor() Modified: trunk/fb-contrib/samples/NCMU_Sample.java =================================================================== --- trunk/fb-contrib/samples/NCMU_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/NCMU_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -3,6 +3,7 @@ import java.util.Vector; +@SuppressWarnings("all") public class NCMU_Sample { public void test(Vector v, Hashtable ht) Modified: trunk/fb-contrib/samples/NCS_Sample.java =================================================================== --- trunk/fb-contrib/samples/NCS_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/NCS_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -4,6 +4,7 @@ import java.io.Serializable; +@SuppressWarnings("all") public class NCS_Sample implements Serializable { private void writeObject(ObjectOutputStream oos) throws IOException Modified: trunk/fb-contrib/samples/NIR_Sample.java =================================================================== --- trunk/fb-contrib/samples/NIR_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/NIR_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,5 +1,6 @@ import javax.swing.JFrame; +@SuppressWarnings("all") public class NIR_Sample extends JFrame { public static final int NIR_VALUE = 1; Modified: trunk/fb-contrib/samples/NOS_Sample.java =================================================================== --- trunk/fb-contrib/samples/NOS_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/NOS_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,5 +1,6 @@ import java.util.Map; +@SuppressWarnings("all") public class NOS_Sample { private Object lock = new Object(); Modified: trunk/fb-contrib/samples/NRTL_Sample.java =================================================================== --- trunk/fb-contrib/samples/NRTL_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/NRTL_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -2,6 +2,7 @@ import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.tagext.TagSupport; +@SuppressWarnings("all") public class NRTL_Sample extends TagSupport { private String sample; private String sample2; Modified: trunk/fb-contrib/samples/OCP_Sample.java =================================================================== --- trunk/fb-contrib/samples/OCP_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/OCP_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -19,6 +19,7 @@ import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; +@SuppressWarnings("all") public class OCP_Sample extends Z implements ActionListener, Serializable { public String getDisplay(HashSet<String> s, String a, String b) Modified: trunk/fb-contrib/samples/OC_Sample.java =================================================================== --- trunk/fb-contrib/samples/OC_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/OC_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,6 +1,7 @@ import java.util.Collection; import java.util.ArrayList; +@SuppressWarnings("all") public class OC_Sample { private java.util.Date ud; Modified: trunk/fb-contrib/samples/ODN_Sample.java =================================================================== --- trunk/fb-contrib/samples/ODN_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/ODN_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -4,6 +4,7 @@ import org.w3c.dom.Text; +@SuppressWarnings("all") public class ODN_Sample { public Document testSimpleElement(Document d) Modified: trunk/fb-contrib/samples/PDP_Sample.java =================================================================== --- trunk/fb-contrib/samples/PDP_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/PDP_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,6 +1,7 @@ import java.util.ArrayList; import java.util.List; +@SuppressWarnings("all") public class PDP_Sample { ArrayList<String> al; Modified: trunk/fb-contrib/samples/PIS_Sample.java =================================================================== --- trunk/fb-contrib/samples/PIS_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/PIS_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -4,6 +4,7 @@ import java.io.ObjectOutputStream; import java.io.Serializable; +@SuppressWarnings("all") public class PIS_Sample { public static void main(String[] args) Modified: trunk/fb-contrib/samples/PL_Sample.java =================================================================== --- trunk/fb-contrib/samples/PL_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/PL_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -3,6 +3,7 @@ +@SuppressWarnings("all") public class PL_Sample { List<String> name = new ArrayList<String>(); Modified: trunk/fb-contrib/samples/RMC_Sample.java =================================================================== --- trunk/fb-contrib/samples/RMC_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/RMC_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -2,6 +2,7 @@ import java.util.Calendar; import java.util.Date; +@SuppressWarnings("all") public class RMC_Sample { String data; Modified: trunk/fb-contrib/samples/S508C_Sample.java =================================================================== --- trunk/fb-contrib/samples/S508C_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/S508C_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -6,6 +6,7 @@ import javax.swing.JFrame; import javax.swing.JLabel; +@SuppressWarnings("all") public class S508C_Sample extends JFrame { private JLabel fLabel = new JLabel("Hello"); Modified: trunk/fb-contrib/samples/SCR_Sample.java =================================================================== --- trunk/fb-contrib/samples/SCR_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/SCR_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -2,6 +2,7 @@ class A {} class B {} +@SuppressWarnings("all") public class SCR_Sample { A a; Modified: trunk/fb-contrib/samples/SCSS_Sample.java =================================================================== --- trunk/fb-contrib/samples/SCSS_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/SCSS_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -4,6 +4,7 @@ import javax.servlet.http.HttpSession; +@SuppressWarnings("all") public class SCSS_Sample { public void setChange(HttpSession session) Modified: trunk/fb-contrib/samples/SG_Sample.java =================================================================== --- trunk/fb-contrib/samples/SG_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/SG_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -10,6 +10,7 @@ import org.w3c.dom.Document; +@SuppressWarnings("all") public class SG_Sample implements ActionListener, WindowListener { String s = "<xml/>"; Modified: trunk/fb-contrib/samples/SIL_Sample.java =================================================================== --- trunk/fb-contrib/samples/SIL_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/SIL_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -3,6 +3,7 @@ import java.sql.ResultSet; import java.sql.SQLException; +@SuppressWarnings("all") public class SIL_Sample { public void test(ResultSet rs) throws SQLException Modified: trunk/fb-contrib/samples/SMII_Sample.java =================================================================== --- trunk/fb-contrib/samples/SMII_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/SMII_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -2,6 +2,7 @@ import java.util.Set; +@SuppressWarnings("all") public class SMII_Sample { private Inner i = new Inner(); Modified: trunk/fb-contrib/samples/SPP_Sample.java =================================================================== --- trunk/fb-contrib/samples/SPP_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/SPP_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -10,6 +10,7 @@ import java.util.Set; import java.util.StringTokenizer; +@SuppressWarnings("all") public class SPP_Sample implements Serializable { public static final long serialVersionUID = -2766574418713802220L; Modified: trunk/fb-contrib/samples/UEC_Sample.java =================================================================== --- trunk/fb-contrib/samples/UEC_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/UEC_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -6,6 +6,7 @@ import java.util.Set; +@SuppressWarnings("all") public class UEC_Sample { public enum Suite { Spades, Hearts, Clubs, Diamonds }; Modified: trunk/fb-contrib/samples/URV_Sample.java =================================================================== --- trunk/fb-contrib/samples/URV_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/URV_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,6 +1,7 @@ import java.util.HashSet; import java.util.TreeSet; +@SuppressWarnings("all") public class URV_Sample extends URV_Super { public Object getASet(boolean b) Modified: trunk/fb-contrib/samples/USBR_Sample.java =================================================================== --- trunk/fb-contrib/samples/USBR_Sample.java 2009-10-18 13:55:21 UTC (rev 1377) +++ trunk/fb-contrib/samples/USBR_Sample.java 2009-10-18 13:56:49 UTC (rev 1378) @@ -1,4 +1,5 @@ +@SuppressWarnings("all") public class USBR_Sample { public int addEm(String csl) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-18 13:55:31
|
Revision: 1377 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1377&view=rev Author: dbrosius Date: 2009-10-18 13:55:21 +0000 (Sun, 18 Oct 2009) Log Message: ----------- remove unneeded annotation Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2009-10-15 14:05:30 UTC (rev 1376) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/collect/CollectStatistics.java 2009-10-18 13:55:21 UTC (rev 1377) @@ -28,7 +28,7 @@ { private int numMethodCalls; - public CollectStatistics(@SuppressWarnings("unused") BugReporter bugReporter) { + public CollectStatistics(BugReporter bugReporter) { Statistics.getStatistics().clear(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-15 14:05:38
|
Revision: 1376 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1376&view=rev Author: dbrosius Date: 2009-10-15 14:05:30 +0000 (Thu, 15 Oct 2009) Log Message: ----------- more patches from bhaskar maddala Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2009-10-15 04:16:44 UTC (rev 1375) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2009-10-15 14:05:30 UTC (rev 1376) @@ -49,6 +49,7 @@ public class ContraVariantArrayAssignment extends BytecodeScanningDetector { private final BugReporter bugReporter; private final OpcodeStack stack; + private final boolean checkMethods; /** * constructs a CVAA detector given the reporter to report bugs on. @@ -57,7 +58,8 @@ */ public ContraVariantArrayAssignment(final BugReporter bugReporter) { this.bugReporter = bugReporter; - this.stack = new OpcodeStack(); + stack = new OpcodeStack(); + checkMethods = System.getProperty("CCVA_CHECKMETHODS") != null; } /** @@ -109,7 +111,7 @@ case INVOKEVIRTUAL: case INVOKEINTERFACE: case INVOKESPECIAL: - if(stack.getStackDepth() > 0){ + if(checkMethods && stack.getStackDepth() > 0){ String signature = getSigConstantOperand(); checkMethodInvocation(signature); } @@ -134,7 +136,7 @@ try{ if(isArrayType(sourceSignature)) { if(!isArrayType(targetSignature)){ - bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", HIGH_PRIORITY) + bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", LOW_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); @@ -143,7 +145,7 @@ ObjectType sourceType = (ObjectType) ((ArrayType) Type.getType(sourceSignature)).getBasicType(); ObjectType targetType = (ObjectType) ((ArrayType) Type.getType(targetSignature)).getBasicType(); if(sourceType.subclassOf(targetType) && !targetType.subclassOf(sourceType)) { - bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", HIGH_PRIORITY) + bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-15 04:16:54
|
Revision: 1375 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1375&view=rev Author: dbrosius Date: 2009-10-15 04:16:44 +0000 (Thu, 15 Oct 2009) Log Message: ----------- more fps Modified Paths: -------------- trunk/fb-contrib/samples/PDP_Sample.java Modified: trunk/fb-contrib/samples/PDP_Sample.java =================================================================== --- trunk/fb-contrib/samples/PDP_Sample.java 2009-10-15 04:16:26 UTC (rev 1374) +++ trunk/fb-contrib/samples/PDP_Sample.java 2009-10-15 04:16:44 UTC (rev 1375) @@ -45,4 +45,14 @@ float f = ((Float) o).floatValue(); } } + + public String testFPFlimsyIfGuard(Comparable<?> c, boolean isNumber) { + String s = c.toString(); + if (isNumber) { + Number n = (Number)c; + s += n.intValue(); + } + + return s; + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-15 04:16:38
|
Revision: 1374 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1374&view=rev Author: dbrosius Date: 2009-10-15 04:16:26 +0000 (Thu, 15 Oct 2009) Log Message: ----------- if the suspicious cast is made in an if, even if not with instanceof don't report it for now Modified Paths: -------------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java Modified: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2009-10-15 03:40:57 UTC (rev 1373) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PoorlyDefinedParameter.java 2009-10-15 04:16:26 UTC (rev 1374) @@ -55,6 +55,7 @@ String parmSig; int state; String castClass; + int downwardBranchTarget; /** * constructs a PDP detector given the reporter to report bugs on @@ -78,6 +79,7 @@ if ((parmSigs.size() > 0) && prescreen(m)) { state = SAW_NOTHING; bugs = new HashMap<Integer, BugInfo>(); + downwardBranchTarget = -1; super.visitCode(obj); for (BugInfo bi : bugs.values()) { bugReporter.reportBug(bi.bug); @@ -108,67 +110,81 @@ @Override public void sawOpcode(int seen) { - switch (state) { - case SAW_NOTHING: - if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { - loadedReg = RegisterUtils.getALoadReg(this, seen); - parmSig = parmSigs.get(Integer14.valueOf(loadedReg)); - if (parmSig != null) { - parmSig = parmSig.substring(1, parmSig.length() - 1); - state = SAW_LOAD; - } - } - break; - - case SAW_LOAD: - if (seen == CHECKCAST) { - castClass = getClassConstantOperand(); - if (!castClass.equals(parmSig)) { - state = SAW_CHECKCAST; - return; - } - } else if (seen == INSTANCEOF) { - // probably an if guard... assume the code is reasonable - parmSigs.remove(Integer14.valueOf(loadedReg)); - } - state = SAW_NOTHING; - break; - - case SAW_CHECKCAST: - if ((seen == PUTFIELD) || (seen == ASTORE) || ((seen >= ASTORE_0) && seen <= ASTORE_3)) { - String parmName = null; - LocalVariableTable lvt = getMethod().getLocalVariableTable(); - if (lvt != null) { - LocalVariable lv = lvt.getLocalVariable(loadedReg, 1); - if (lv != null) { - parmName = lv.getName(); - } - } - if (parmName == null) { - parmName = "(" + loadedReg + ")"; - } - - BugInstance bug = new BugInstance(this, "PDP_POORLY_DEFINED_PARAMETER", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this) - .addString(parmName); - Integer lr = Integer14.valueOf(loadedReg); - BugInfo bi = bugs.get(lr); - if (bi == null) { - bugs.put(lr, new BugInfo(castClass, bug)); - } else { - //If there are casts to multiple different types, don't report it altho suspect - if (!bi.castClass.equals(castClass)) { - bugs.remove(lr); - } - } - - } - - state = SAW_NOTHING; - break; - } + if (downwardBranchTarget == -1) { + switch (state) { + case SAW_NOTHING: + if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { + loadedReg = RegisterUtils.getALoadReg(this, seen); + parmSig = parmSigs.get(Integer14.valueOf(loadedReg)); + if (parmSig != null) { + parmSig = parmSig.substring(1, parmSig.length() - 1); + state = SAW_LOAD; + } + } + break; + + case SAW_LOAD: + if (seen == CHECKCAST) { + castClass = getClassConstantOperand(); + if (!castClass.equals(parmSig)) { + state = SAW_CHECKCAST; + return; + } + } else if (seen == INSTANCEOF) { + // probably an if guard... assume the code is reasonable + parmSigs.remove(Integer14.valueOf(loadedReg)); + } + state = SAW_NOTHING; + break; + + case SAW_CHECKCAST: + if ((seen == PUTFIELD) || (seen == ASTORE) || ((seen >= ASTORE_0) && seen <= ASTORE_3)) { + String parmName = null; + LocalVariableTable lvt = getMethod().getLocalVariableTable(); + if (lvt != null) { + LocalVariable lv = lvt.getLocalVariable(loadedReg, 1); + if (lv != null) { + parmName = lv.getName(); + } + } + if (parmName == null) { + parmName = "(" + loadedReg + ")"; + } + + BugInstance bug = new BugInstance(this, "PDP_POORLY_DEFINED_PARAMETER", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this) + .addString(parmName); + Integer lr = Integer14.valueOf(loadedReg); + BugInfo bi = bugs.get(lr); + if (bi == null) { + bugs.put(lr, new BugInfo(castClass, bug)); + } else { + //If there are casts to multiple different types, don't report it altho suspect + if (!bi.castClass.equals(castClass)) { + bugs.remove(lr); + } + } + + } + + state = SAW_NOTHING; + break; + } + if ((seen >= IFEQ) && (seen <= IF_ACMPNE)) { + downwardBranchTarget = getBranchTarget(); + if (downwardBranchTarget < getPC()) + downwardBranchTarget = -1; + } + } else { + state = SAW_NOTHING; + if (getPC() >= downwardBranchTarget) + downwardBranchTarget = -1; + } + + + } private static class BugInfo { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-15 03:41:05
|
Revision: 1373 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1373&view=rev Author: dbrosius Date: 2009-10-15 03:40:57 +0000 (Thu, 15 Oct 2009) Log Message: ----------- Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2009-10-15 03:39:40 UTC (rev 1372) +++ trunk/fb-contrib/htdocs/index.html 2009-10-15 03:40:57 UTC (rev 1373) @@ -71,7 +71,7 @@ each class knows about each other and is able to compare themselves with each other.</li> <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/> + must be restricted to covariant or invariant usage. <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span></li> </ul> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-15 03:39:46
|
Revision: 1372 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1372&view=rev Author: dbrosius Date: 2009-10-15 03:39:40 +0000 (Thu, 15 Oct 2009) Log Message: ----------- attribution Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2009-10-15 03:36:23 UTC (rev 1371) +++ trunk/fb-contrib/htdocs/index.html 2009-10-15 03:39:40 UTC (rev 1372) @@ -71,7 +71,8 @@ each class knows about each other and is able to compare themselves with each other.</li> <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.</li> + must be restricted to covariant or invariant usage.<br/> + <span style="color: #0000FF;">--contributed by Bhaskar Maddala - THANKS!</span></li> </ul> </div> <hr/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-15 03:36:29
|
Revision: 1371 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1371&view=rev Author: dbrosius Date: 2009-10-15 03:36:23 +0000 (Thu, 15 Oct 2009) Log Message: ----------- new detector CVAA - by Bhaskar Maddala Modified Paths: -------------- trunk/fb-contrib/htdocs/index.html Modified: trunk/fb-contrib/htdocs/index.html =================================================================== --- trunk/fb-contrib/htdocs/index.html 2009-10-15 03:34:37 UTC (rev 1370) +++ trunk/fb-contrib/htdocs/index.html 2009-10-15 03:36:23 UTC (rev 1371) @@ -69,6 +69,9 @@ symmetry. If a equals b, then b equals a. While it is usually wrong to allow equals to compare different types, at the very least you should make sure that each class knows about each other and is able to compare themselves with each other.</li> + <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.</li> </ul> </div> <hr/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-15 03:34:44
|
Revision: 1370 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1370&view=rev Author: dbrosius Date: 2009-10-15 03:34:37 +0000 (Thu, 15 Oct 2009) Log Message: ----------- add new detector CVAA - by Bhaskar Maddala Added Paths: ----------- trunk/fb-contrib/samples/CVAA_Sample.java Added: trunk/fb-contrib/samples/CVAA_Sample.java =================================================================== --- trunk/fb-contrib/samples/CVAA_Sample.java (rev 0) +++ trunk/fb-contrib/samples/CVAA_Sample.java 2009-10-15 03:34:37 UTC (rev 1370) @@ -0,0 +1,26 @@ + +public class CVAA_Sample +{ + Base[] b2; + Derived[] d2; + class Base {} + + class Derived extends Base {} + + public void cvaa() + { + Derived[] d = new Derived[2]; + cvaa_invoke(d, 5); + Base[] b = d; + cvaa_invoke(b, 5); + b2 = d; + d2 = d; + b[0] = new Base(); + + Integer[] a = new Integer[1]; + System.arraycopy(a[0], 0, a, 1, 1); + } + + private void cvaa_invoke(Base[] b, int n){ + } +} Property changes on: trunk/fb-contrib/samples/CVAA_Sample.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...> - 2009-10-15 03:34:27
|
Revision: 1369 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1369&view=rev Author: dbrosius Date: 2009-10-15 03:34:19 +0000 (Thu, 15 Oct 2009) Log Message: ----------- add new detector CVAA - by Bhaskar Maddala Modified Paths: -------------- trunk/fb-contrib/etc/findbugs.xml Modified: trunk/fb-contrib/etc/findbugs.xml =================================================================== --- trunk/fb-contrib/etc/findbugs.xml 2009-10-15 03:34:03 UTC (rev 1368) +++ trunk/fb-contrib/etc/findbugs.xml 2009-10-15 03:34:19 UTC (rev 1369) @@ -377,6 +377,10 @@ <Detector class="com.mebigfatguy.fbcontrib.detect.NonSymmetricEquals" speed="fast" reports="NSE_NON_SYMMETRIC_EQUALS" /> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment" + speed="fast" + reports="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" /> <!-- BugPattern --> @@ -506,4 +510,5 @@ <BugPattern abbrev="OC" type="OC_OVERZEALOUS_CASTING" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="PDP" type="PDP_POORLY_DEFINED_PARAMETER" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="NSE" type="NSE_NON_SYMMETRIC_EQUALS" category="CORRECTNESS" experimental="true" /> + <BugPattern abbrev="CVAA" type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT" category="CORRECTNESS" experimental="true"/> </FindbugsPlugin> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-15 03:34:15
|
Revision: 1368 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1368&view=rev Author: dbrosius Date: 2009-10-15 03:34:03 +0000 (Thu, 15 Oct 2009) Log Message: ----------- add new detector CVAA - by Bhaskar Maddala Modified Paths: -------------- trunk/fb-contrib/etc/messages.xml Modified: trunk/fb-contrib/etc/messages.xml =================================================================== --- trunk/fb-contrib/etc/messages.xml 2009-10-15 03:33:46 UTC (rev 1367) +++ trunk/fb-contrib/etc/messages.xml 2009-10-15 03:34:03 UTC (rev 1368) @@ -1047,6 +1047,25 @@ ]]> </Details> </Detector> + + <Detector class="com.mebigfatguy.fbcontrib.detect.ContraVariantArrayAssignment"> + <Details> + <![CDATA[ + <p>Finds contravariant array assignments. Since arrays are mutable data structures, their use + must be restricted to covariant or invariant usage</p> + + <pre> + class A {} + class B extends A {} + + B[] b = new B[2]; + A[] a = b; + a[0] = new A(); // results in ArrayStoreException (Runtime) + </pre> + <p>It is a fast detector</p> + ]]> + </Details> + </Detector> <!-- BugPattern --> @@ -2706,6 +2725,27 @@ </Details> </BugPattern> + <BugPattern type="CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT"> + <ShortDescription>method performs a contravariant array assignment</ShortDescription> + <LongDescription>method {1} performs a contravariant array assignment</LongDescription> + <Details> + <![CDATA[ + <p>Finds contravariant array assignments. Since arrays are mutable data structures, their use + must be restricted to covariant or invariant usage</p> + + <pre> + class A {} + class B extends A {} + + B[] b = new B[2]; + A[] a = b; + a[0] = new A(); // results in ArrayStoreException (Runtime) + </pre> + <p>It is a fast detector</p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -2794,4 +2834,5 @@ <BugCode abbrev="OC">Overzealous Casting</BugCode> <BugCode abbrev="PDP">Poorly Defined Parameter</BugCode> <BugCode abbrev="NSE">Non Symmetric Equals</BugCode> + <BugCode abbrev="CVAA">Contravariant Array Assignment</BugCode> </MessageCollection> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dbr...@us...> - 2009-10-15 03:33:59
|
Revision: 1367 http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1367&view=rev Author: dbrosius Date: 2009-10-15 03:33:46 +0000 (Thu, 15 Oct 2009) Log Message: ----------- add new detector CVAA - by Bhaskar Maddala Added Paths: ----------- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java Added: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java =================================================================== --- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java (rev 0) +++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.java 2009-10-15 03:33:46 UTC (rev 1367) @@ -0,0 +1,169 @@ +/* + * fb-contrib - Auxiliary detectors for Java programs + * Copyright (C) 2009 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 + */ +package com.mebigfatguy.fbcontrib.detect; + +import org.apache.bcel.classfile.Code; +import org.apache.bcel.classfile.LocalVariable; +import org.apache.bcel.classfile.LocalVariableTable; +import org.apache.bcel.generic.ArrayType; +import org.apache.bcel.generic.ObjectType; +import org.apache.bcel.generic.Type; + +import com.mebigfatguy.fbcontrib.utils.RegisterUtils; + +import edu.umd.cs.findbugs.BugInstance; +import edu.umd.cs.findbugs.BugReporter; +import edu.umd.cs.findbugs.BytecodeScanningDetector; +import edu.umd.cs.findbugs.OpcodeStack; + +/** + * 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> + * + */ +public class ContraVariantArrayAssignment extends BytecodeScanningDetector { + private final BugReporter bugReporter; + private final OpcodeStack stack; + + /** + * constructs a CVAA detector given the reporter to report bugs on. + + * @param bugReporter the sync of bug reports + */ + public ContraVariantArrayAssignment(final BugReporter bugReporter) { + this.bugReporter = bugReporter; + this.stack = new OpcodeStack(); + } + + /** + * 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 + * SourceLineAnnotations for fields, if accessed. + * + * @param obj the context object of the currently parsed code attribute + */ + @Override + public void visitCode(Code obj) { + stack.resetForMethodEntry(this); + LocalVariableTable lvt = getMethod().getLocalVariableTable(); + if(lvt != null) { + super.visitCode(obj); + } + } + + @Override + public void sawOpcode(int seen) { + try{ + switch(seen){ + case ASTORE: + case ASTORE_0: + case ASTORE_1: + case ASTORE_2: + 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 targetSignature = lv.getSignature(); + checkSignatures(sourceSignature, targetSignature); + } + } + break; + case PUTFIELD: + case PUTSTATIC: + if(stack.getStackDepth() > 0){ + OpcodeStack.Item item = stack.getStackItem(0); + String sourceSignature = item.getSignature(); + String targetSignature = getSigConstantOperand(); + checkSignatures(sourceSignature, targetSignature); + } + break; + case INVOKESTATIC: + case INVOKEVIRTUAL: + case INVOKEINTERFACE: + case INVOKESPECIAL: + if(stack.getStackDepth() > 0){ + String signature = getSigConstantOperand(); + checkMethodInvocation(signature); + } + break; + } + super.sawOpcode(seen); + } + finally{ + 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; + } + + private void checkSignatures(String sourceSignature, String targetSignature) { + try{ + if(isArrayType(sourceSignature)) { + if(!isArrayType(targetSignature)){ + bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", HIGH_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } else { + if(isObjectType(sourceSignature) && isObjectType(targetSignature)){ + ObjectType sourceType = (ObjectType) ((ArrayType) Type.getType(sourceSignature)).getBasicType(); + ObjectType targetType = (ObjectType) ((ArrayType) Type.getType(targetSignature)).getBasicType(); + if(sourceType.subclassOf(targetType) && !targetType.subclassOf(sourceType)) { + bugReporter.reportBug(new BugInstance(this, "CVAA_CONTRAVARIANT_ARRAY_ASSIGNMENT", HIGH_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLine(this)); + } + } + } + } + } + catch(ClassNotFoundException cnfe) { + bugReporter.reportMissingClass(cnfe); + } + } + + private void checkMethodInvocation(String signature) { + Type[] types = Type.getArgumentTypes(signature); + for(int i = 0; i < types.length; i++){ + String targetSignature = types[i].getSignature(); + OpcodeStack.Item item = stack.getStackItem(types.length - i - 1); + String sourceSignature = item.getSignature(); + checkSignatures(sourceSignature, targetSignature); + } + } +} Property changes on: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ContraVariantArrayAssignment.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. |