Declaration redundancy
- 'final' method in 'final' class
Reports final methods in final classes.
- 'protected' member in 'final' class
Reports protected members in finalclasses.
- Access static member via instance reference
Reports references to static methods and fields via a class instance rather than the class itself.
- Declaration access can be weaker
Reports fields, methods or classes that may have their access modifier narrowed down.
- Declaration can have 'final' modifier
Reports fields, methods, or classes that may have the final modifier added to their declarations.
- Default annotation parameter value
Reports annotation parameters that are assigned to their default value.
- Duplicate throws
Reports duplicate exceptions in a method throws list.
- Empty class initializer
Reports empty class initializer blocks.
- Functional expression can be folded
Reports method references or lambda expressions that point to a method of their own functional interface type and hence can be replaced with their qualifiers removing unnecessary object allocation.
- Method always returns the same value
Reports methods and method hierarchies that always return the same constant.
- Method can be made 'void'
Reports methods whose return values are never used when called.
- Method parameter always has the same value
Reports method parameters that always have the same constant value.
- Redundant 'close()'
Reports unnecessary calls to close() at the end of a try-with-resources block and suggests removing them.
- Redundant 'requires' directive in module-info
Reports redundant requires directives in Java Platform Module System module-info.java files.
- Redundant 'throws' clause
Reports exceptions that are declared in a method's signature but never thrown by the method itself or its implementations and overriding methods.
- Redundant lambda parameter types
Reports lambda formal parameter types that are redundant because they can be inferred from the context.
- Redundant record constructor
Reports redundant constructors declared inside Java records.
- Trivial usage of functional expression
Reports functional interface methods calls that are directly invoked on the definition of the lambda, method reference, or anonymous class.
- Unnecessary module dependency
Reports dependencies on modules that are not used.
- Unused declaration
Reports classes, methods, or fields that are not used or unreachable from the entry points.
- Unused label
Reports labels that are not targets of any break or continue statements.
- Unused library
Reports libraries attached to the specified inspection scope that are not used directly in code.
- Variable is assigned to itself
Reports assignments of a variable to itself.