Inspectopedia 2024.3 Help

Verbose or redundant code constructs

'StringBuilder' can be replaced with 'String'   New in this release

Reports usages of StringBuffer, StringBuilder, or StringJoiner which can be replaced with a single String concatenation.

Cast can be replaced with variable   New in this release

Reports type cast operations that can be replaced with existing local or pattern variables with the same value.

Comparator method can be simplified   New in this release

Reports Comparator combinator constructs that can be simplified.

Concatenation with empty string   New in this release

Reports empty string operands in string concatenations.

Condition is covered by further condition   New in this release

Reports conditions that become redundant as they are completely covered by a subsequent condition.

Copy of existing static method body   New in this release

Reports fragments of Java code which are identical to the existing static methods suggesting to reuse these static methods.

Duplicate branches in 'switch'   New in this release

Reports switch statements or expressions that contain the same code in different branches and suggests merging the duplicate branches.

Excessive lambda usage   New in this release

Reports if a trivial lambda expression is used in cases in which there's an alternative method that behaves in the same way, but accepts a concrete value instead of a lambda.

Excessive range check   New in this release

Reports condition chains in which a value range is checked and these condition chains can be simplified to a single check.

Explicit array filling   New in this release

Reports loops that can be replaced with Arrays.setAll() or Arrays.fill() calls.

Lombok @Getter may be used   New in this release

Reports standard getter method that can be replaced by the lombok @Getter annotation.

Lombok @Setter may be used   New in this release

Reports standard setter method that can be replaced by the lombok @Setter annotation.

Manual min/max calculation   New in this release

Reports cases where the minimum or the maximum of two numbers can be calculated using a Math.max() or Math.min() call, instead of doing it manually.

Mapping call before count()   New in this release

Reports redundant Stream API calls like map(), or boxed() right before the count() call.

Multiple occurrences of the same expression   New in this release

Reports multiple equivalent occurrences of the same expression within a method (or constructor, or class initializer) if the result of the expression can be reused.

Non-strict inequality '>=' or '<=' can be replaced with '=='   New in this release

Reports inequality conditions that, according to data flow analysis, can be satisfied only for a single operand value.

Null-check method is called with obviously non-null argument   New in this release

Reports if a null-checking method (for example, Objects.requireNonNull or Assert.assertNotNull) is called on a value that is obviously non-null (for example, a newly created object).

Only one element is used   New in this release

Reports lists, arrays, and strings where exactly one element is queried right upon the creation.

Optional call chain can be simplified   New in this release

Reports Optional call chains that can be simplified.

Redundant 'Collection' operation   New in this release

Reports unnecessarily complex collection operations which have simpler alternatives.

Redundant 'File' instance creation   New in this release

Reports redundant File creation in one of the following constructors when only String path can be used: FileInputStream, FileOutputStream, FileReader, FileWriter, PrintStream, PrintWriter, Formatter.

Redundant 'String' operation   New in this release

Reports redundant calls to String constructors and methods like toString() or substring() that can be replaced with a simpler expression.

Redundant 'compare()' method call   New in this release

Reports comparisons in which the compare method is superfluous.

Redundant 'isInstance()' or 'cast()' call   New in this release

Reports redundant calls of java.lang.Class methods.

Redundant array creation   New in this release

Reports arrays that are created specifically to be passed as a varargs parameter.

Redundant array length check   New in this release

Reports unnecessary array length checks followed by array iteration.

Redundant embedded expression in string template   New in this release

Reports redundant embedded expressions in STR templates, such as trivial literals or empty expressions.

Redundant escape in regex replacement string   New in this release

Reports redundant escapes in the replacement string of regex methods.

Redundant operation on 'java.time' object   New in this release

Reports redundant operation on 'java.time' object redundant: creation of date/time objects from the JDK java.time package when simpler method calls can be used or creation can be avoided.

Redundant step in 'Stream' or 'Optional' call chain   New in this release

Reports redundant Stream or Optional calls like map(x -> x), filter(x -> true) or redundant sorted() or distinct() calls.

Redundant type arguments  

Reports calls to parametrized methods with explicit argument types that can be omitted since they will be unambiguously inferred by the compiler.

Redundant type cast   New in this release

Reports unnecessary cast expressions.

Redundant usage of unmodifiable collection wrappers   New in this release

Reports redundant calls to unmodifiable collection wrappers from the Collections class.

Replacement operation has no effect   New in this release

Reports calls to the String methods replace(), replaceAll() or replaceFirst() that have no effect.

Simplifiable collector   New in this release

Reports collectors that can be simplified.

Stream API call chain can be simplified   New in this release

Reports stream API call chains that can be simplified.

Too weak variable type leads to unnecessary cast   New in this release

Reports type casts that can be removed if the variable type is narrowed to the cast type.

Unnecessarily escaped character   New in this release

Reports unnecessarily escaped characters in String and optionally char literals.

Unnecessary 'break' statement   New in this release

Reports any unnecessary break statements.

Unnecessary 'continue' statement  

Reports continue statements if they are the last reachable statements in the loop.

Unnecessary 'default' for enum 'switch' statement   New in this release

Reports enum switch statements or expression with default branches which can never be taken, because all possible values are covered by a case branch.

Unnecessary 'return' statement  

Reports return statements at the end of constructors and methods returning void.

Unnecessary label on 'break' statement  

Reports break statements with unnecessary labels.

Unnecessary label on 'continue' statement  

Reports continue statements with unnecessary labels.

Last modified: 03 December 2024