Fixes `ZeroLengthArrayInitialization` inspection violations in test code.
Description:
>Reports on allocations of arrays with known lengths of zero. Since array lengths in Java are non-modifiable, it is almost always possible to share zero-length arrays, rather than repeatedly allocating new zero-length arrays. Such sharing may provide useful optimizations in program runtime or footprint. Note that this inspection does not report zero-length arrays allocated as static final fields, as it is assumed that those arrays are being used to implement array sharing.
Fixes `UnnecessaryLocalVariable` inspection violations.
Description:
>Reports unnecessary local variables, which add nothing to the comprehensibility of a method. Variables caught include local variables which are immediately returned, local variables that are immediately assigned to another variable and then not used, and local variables which always have the same value as another local variable or parameter.
Fixes `NegatedIfElse` inspection violations.
Description:
>Reports if statements which contain else branches and whose conditions are negated. Flipping the order of the if and else branches will usually increase the clarity of such statements.
Fixes `PublicConstructorInNonPublicClass` inspection violations.
Description:
>Reports all constructors in non-public classes that are declared public.
Fixes `CallToSimpleGetterInClass` inspection violations.
Description:
>Reports any calls to a simple property getter from within the property's class. A simple property getter is defined as one which simply returns the value of a field, and does no other calculation. Such simple getter calls may be safely inlined, at a small performance improvement. Some coding standards also suggest against the use of simple getters for code clarity reasons.
Fixes `IgnoreResultOfCall` inspection violations in test code.
Description:
>Reports any calls to specific methods where the result of that call is ignored. Both methods specified in the inspection's settings and methods annotated with org.jetbrains.annotations.Contract(pure=true) are checked. For many methods, ignoring the result is perfectly legitimate, but for some methods it is almost certainly an error. Examples of methods where ignoring the result of a call is likely to be an error include java.io.inputStream.read(), which returns the number of bytes actually read, any method on java.lang.String or java.math.BigInteger, as all of those methods are side-effect free and thus pointless if ignored.
Fixes `NullArgumentToVariableArgMethod` inspection violations in test code.
Description:
>Reports any calls to a variable-argument method which has a null in the variable-argument position (e.g System.out.printf("%s", null) ). Such a null argument may be confusing, as it is not wrapped as a single-element array, as may be expected.
Fixes `ClassNewInstance` inspection violations in test code.
Description:
>Reports any calls to java.lang.Class.newInstance(). The newInstance method propagates any exception thrown by the no-arg constructor, including checked exceptions. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler. Replacing such a method call with a call to the java.lang.reflect.Constructor.newInstance() method avoids this problem by wrapping any exception thrown by the constructor in a java.lang.reflect.InvocationTargetException.
Fixes `UseOfPropertiesAsHashtable` inspection violations in test code.
Description:
>Reports any calls to the java.util.Hashtable methods put(), putAll() or get() on a java.util.Properties object. For reasons lost to history, Properties inherits from Hashtable, but use of those methods is discouraged to prevent corruption of properties values with non-String data.
Fixes `StaticFieldReferenceOnSubclass` inspection violations.
Description:
>Reports static field accesses where the call is qualified by a subclass of the declaring class, rather than the declaring class itself. Java allows such qualification, but such accesses may be confusing, and may indicate a subtle confusion of inheritance and overriding.
Fixes `UnnecessaryToStringCall` inspection violations in test code.
Description:
>Reports on any calls to toString() used in string concatenations and as arguments to the print() and println() methods of java.io.PrintWriter and java.io.PrintStream, the append() method of java.lang.StringBuilder and java.lang.StringBuffer or the trace(), debug(), info(), warn() and error() methods of org.slf4j.Logger. In these cases the conversion to string will be handled by the underlying library methods and an explicit call to toString() is no needed.
Note that without the toString() call the expression will have slightly different semantics (the string null will be used instead of throwing a NullPointerException).
Fixes `UnnecessaryThis` inspection violations in test code.
Description:
>Reports on any unnecessary uses of this in the code. Using this to disambiguate a code reference may easily become unnecessary via automatic refactorings, and is discouraged by many coding styles.
Fixes `UnnecessarilyQualifiedStaticallyImportedElement` inspection violations in test code.
Description:
>Reports any references to static members which are statically imported and also qualified with their containing class name. Because the elements are already statically imported such qualification is unnecessary and can be removed.
Fixes `UnnecessaryConstantArrayCreationExpression` inspection violations in test code.
Description:
>Reports any constant new array expression which can be replaced with an array initializer. Array initializers omit the type declaration because that is already specified by the declaration of the variable the expression is assigned to.
Fixes `UnnecessaryParentheses` inspection violations in test code.
Description:
>Reports on any instance of unnecessary parentheses. Parentheses are considered unnecessary if the evaluation order of an expression remains unchanged if the parentheses are removed.
Fixes `ThrowablePrintStackTrace` inspection violations in test code.
Description:
>Reports any calls to Throwable.printStackTrace() without arguments. Such statements are often used for temporary debugging, and should probably be either removed from production code, or replaced with a more robust logging facility.
Fixes `RedundantThrows` inspection violations in test code.
Description:
>This inspection reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations/derivatives.
Fixes `StringToUpperWithoutLocale` inspection violations in test code.
Description:
>Reports any call of toUpperCase() or toLowerCase() on String objects which do not specify a java.util.Locale. Such calls are usually incorrect in an internationalized environment.
Fixes `NumericToString` inspection violations in test code.
Description:
>Reports any call of toString() on numeric objects. Such calls are usually incorrect in an internationalized environment.
Fixes `TryWithIdenticalCatches` inspection violations in test code.
Description:
>Reports identical catch sections in try blocks under JDK 7. A quickfix is available to collapse the sections into a multi-catch section.
This inspection only reports if the project or module is configured to use a language level of 7.0 or higher.
Fixes `MultipleExceptionsDeclaredOnTestMethod` inspection violations.
Description:
>Reports JUnit test methods with more than one exception declared in the throws clause. Such a throws clause can be more concisely declared as `throws Exception`.
Fixes some `ZeroLengthArrayInitialization` inspection violations.
Description:
>Reports on allocations of arrays with known lengths of zero. Since array lengths in Java are non-modifiable, it is almost always possible to share zero-length arrays, rather than repeatedly allocating new zero-length arrays. Such sharing may provide useful optimizations in program runtime or footprint. Note that this inspection does not report zero-length arrays allocated as static final fields, as it is assumed that those arrays are being used to implement array sharing.
Fixes `StandardVariableNames` inspection violations in test code.
Description:
>Reports on any variables with 'standard' names which are of unexpected types. Such names may be confusing. Standard names and types are as follows:
- i, j, k, m, n - int
- f - float
- d - double
- b - byte
- c, ch - char
- l - long
- s, str - String
Fixes `CallToSimpleSetterInClass` inspection violations.
Description:
>Reports any calls to a simple property setter from within the property's class. A simple property setter is defined as one which simply assigns the value of its parameter to a field, and does no other calculation. Such simple setter calls may be safely inlined, at a small performance improvement. Some coding standards also suggest against the use of simple setters for code clarity reasons.
Fixes `FieldMayBeStatic` inspection violations.
Description:
>Reports any instance variables which may safely be made static. A field may be static if it is declared final, and is initialized with a constant.
Fixes `ParametersPerMethod` inspection violation.
Description:
>Reports methods with too many parameters. Methods with too many parameters can be a good sign that refactoring is necessary. Methods whose signatures are inherited from library classes are ignored by this inspection.
Fixes `SuspiciousGetterSetter` inspection violations.
Description:
>Reports suspicious getter or setter methods. A getter or setter is suspicious if it accesses a different field than would be expected by its name.
Fixes `RedundantMethodOverride` inspection violations in test code.
Description:
>Reports any method that has a body and signature that are identical to its super method. Such a method is redundant and probably a coding error.
Fixes `ConstantNamingConvention` inspection violations in test code.
Description:
>Reports any constants whose names are either too short, too long, or do not follow the specified regular expression pattern. Constants are fields declared static final.
Fixes `MethodCanBeVariableArityMethod` inspection violations in test code.
Description:
>Reports methods with which can be converted to be a variable arity/varargs method, available in Java 5 and newer.
This inspection only reports if the project or module is configured to use a language level of 5.0 or higher.
Additionally, obsolete assertions were removed.
Fixes `TooBroadScope` inspection violations.
Description:
>Reports any variable declarations of which the scope can be narrowed. Especially useful for "Pascal style" declarations at the start of a method, but variables with too broad a scope are also often left over after refactorings.
Fixes `StaticMethodNamingConvention` inspection violations in test code.
Description:
>Reports static methods whose names are either too short, too long, or do not follow the specified regular expression pattern.
Fixes `ThrowsRuntimeException` inspection violations in test code.
Description:
>Reports declarations of unchecked exceptions (RuntimeException and its subclasses) in the throws clause of a method. Declaration of unchecked exceptions are not required and may be removed or moved to a Javadoc @throws tag.