132 lines
5.4 KiB
Plaintext
132 lines
5.4 KiB
Plaintext
=====================================
|
|
=========Useful Fix Patterns=========
|
|
=====================================
|
|
==============Detailed===============
|
|
DM_CONVERT_CASE
|
|
(1) ADD a rule of Locale.ENGLISH into toLowerCase/toUpperCase.
|
|
RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
|
|
(1) DEL Null-Check IfStatement,
|
|
(2) DEL Null-Check Conditional Expression.
|
|
REC_CATCH_EXCEPTION
|
|
(1) Change Exception to a specific exception class.
|
|
SE_NO_SERIALVERSIONID
|
|
(1) Insert a private static final field serialVersionUID.
|
|
VA_FORMAT_STRING_USES_NEWLINE
|
|
(1) DEL "$backslash$n",
|
|
(2) Replace "$backslash$n" with "n"
|
|
MS_SHOULD_BE_FINAL
|
|
(1) ADD a ``final'' modifier.
|
|
WMI_WRONG_MAP_ITERATOR
|
|
(1) Replace the KeySet iterating ForStatement with an EntrySet iterating ForStatement.
|
|
DM_NUMBER_CTOR
|
|
(1) Replace the NumberType ClassInstanceCreation with a NumberType.valueOf() method invocation.
|
|
SIC_INNER_SHOULD_BE_STATIC
|
|
(1) ADD a "static" modifier,
|
|
(2) DEL the buggy statements.
|
|
DE_MIGHT_IGNORE
|
|
(1) Change Exception to a specific exception class.
|
|
DM_BOXED_PRIMITIVE_FOR_PARSING
|
|
(1) Replace NumberType.valueOf() with NumberType.parseNumberType().
|
|
DM_FP_NUMBER_CTOR
|
|
(1) DEL the buggy statement,
|
|
(2) Replace Double or Float ClassInstanceCreation with (Double or Float).valueOf(),
|
|
(3) Remove the Double or Float ClassInstanceCreation from the buggy expression.
|
|
MS_PKGPROTECT
|
|
(1) DEL the buggy statement,
|
|
(2) DEL the ``public'' or ``protected'' modifier
|
|
(3) Replace the ``public'' or ``protected'' modifier with the ``private'' modifier.
|
|
(4) DEL the initialization expression.
|
|
ES_COMPARING_STRINGS_WITH_EQ
|
|
(1) Replace the ``=='' InfixExpression with a stringVar.equals() method invocation.
|
|
|
|
|
|
===============Abstract==============
|
|
NP_NULL_ON_SOME_PATH
|
|
(1) ADD a Null-check statement or expression.
|
|
RI_REDUNDANT_INTERFACES
|
|
(1) DEL the implemented Interface type.
|
|
NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE
|
|
(1) ADD a Null-check statement or expression,
|
|
(2) DEL the buggy statement.
|
|
UCF_USELESS_CONTROL_FLOW
|
|
(1) DEL the buggy statement,
|
|
(2) DEL the useless ConditionalExpression.
|
|
UC_USELESS_CONDITION
|
|
(1) UPD the operator of a ConditionalExpersion,
|
|
(2) UPD an sub-expression of a ConditionExpression.
|
|
NP_LOAD_OF_KNOWN_NULL_VALUE
|
|
(1) DEL Null-check expression or statement,
|
|
(2) Replace the null-known variable with NULL.
|
|
SBSC_USE_STRINGBUFFER_CONCATENATION
|
|
(1) Replace String type with StringBuilder, and replace plus operator of StringVarialbe with the append method of StringBuilder.
|
|
UC_USELESS_OBJECT
|
|
(1) DEL the buggy statement.
|
|
UPM_UNCALLED_PRIVATE_METHOD
|
|
(1) DEL the buggy statements.
|
|
NM_METHOD_NAMING_CONVENTION
|
|
(1) Update Method Name of MethodDeclaration.
|
|
URF_UNREAD_FIELD
|
|
(1) DEL the buggy statement.
|
|
=====================================
|
|
NP_NONNULL_RETURN_VIOLATION
|
|
(1) DEL the null-returned ReturnStatement.
|
|
(2) Replace NullLiteral with an Expression which returns an empty list.
|
|
PZLA_PREFER_ZERO_LENGTH_ARRAYS
|
|
(1) DEL the buggy statement,
|
|
√ (2) Replace NullLiteral with an empty array.
|
|
SIC_INNER_SHOULD_BE_STATIC_ANON
|
|
(1) DEL a parameter of a ClassInstanceCreation in an AnonymousClassDeclaration,
|
|
(2) DEL the statement contains an AnonymousClassDeclaration,
|
|
√ (3) Replace the AnonymousClassDeclaration with an defined Static Object of this class.
|
|
DLS_DEAD_LOCAL_STORE
|
|
(1) DEL the buggy statement.
|
|
DM_DEFAULT_ENCODING
|
|
√ (1) ADD a parameter (i.e., "UTF-8") into the ClassInstanceCreation of a Stream object.
|
|
(2) Replace ClassInstanceCreation with a MethodInvocation.
|
|
(3) DEL the buggy statement.
|
|
BC_UNCONFIRMED_CAST
|
|
(1) DEL the buggy statement,
|
|
(2) DEL the Cast Type,
|
|
(3) Replace CastExpression with NullLiteral.
|
|
URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD
|
|
(1) ADD a ``final'' modifier,
|
|
√ (2) DEL the buggy statement.
|
|
RV_RETURN_VALUE_IGNORED_BAD_PRACTICE
|
|
(1) Replace boolean-returned statement with a a new MethodInvocation.
|
|
√ (2) ADD an IfStatement.
|
|
EI_EXPOSE_REP
|
|
(1) DEL the buggy statement,
|
|
* (2) Replace the being assigned Expression with a ConditionalExpression.
|
|
√ (3) Replace the Expression being assigned with other Expression
|
|
EI_EXPOSE_REP2
|
|
(1) DEL the buggy statement,
|
|
* (2) Replace the being assigned Expression with a ConditionalExpression.
|
|
√ (3) Replace the being assigned Expression with other Expression.
|
|
|
|
=====================================
|
|
==========Null Fix Patterns==========
|
|
=====================================
|
|
UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR null.
|
|
OBL_UNSATISFIED_OBLIGATION null.
|
|
OS_OPEN_STREAM_EXCEPTION_PATH null.
|
|
SF_SWITCH_NO_DEFAULT null.
|
|
UWF_UNWRITTEN_FIELD null.
|
|
IS2_INCONSISTENT_SYNC null.
|
|
ODR_OPEN_DATABASE_RESOURCE null.
|
|
SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING null.
|
|
OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE null.
|
|
OS_OPEN_STREAM null.
|
|
NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE null.
|
|
|
|
=====================================
|
|
========Useless Fix Patterns=========
|
|
=====================================
|
|
BC_UNCONFIRMED_CAST_OF_RETURN_VALUE
|
|
(1) UPD T1 v1 = (T1) method_invocation() with T2 v1 = method_invocation(),
|
|
(2) DEL the buggy statement,
|
|
(3) Replace the buggy CastExpresion with a MethodInvocation.
|
|
ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD
|
|
(1) DEL the buggy statement.
|
|
RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
|
|
(1) ADD a Null-check statement or expression.
|