Inspectopedia Help

Probable bugs

'@Deferred' result is unused  

Reports function calls with the Deferred result type if the return value is not used.

'catch' block may ignore exception  

Reports catch blocks that are empty or may ignore an exception.

'equals()' and 'hashCode()' not paired  

Reports classes that override equals() but do not override hashCode(), or vice versa.

'equals()' between objects of inconvertible types  

Reports calls to equals() where the receiver and the argument are of incompatible primitive, enum, or string types.

'lateinit var' property overrides 'lateinit var' property  

Reports lateinit var properties that override other lateinit var properties.

Ambiguous coroutineContext due to CoroutineScope receiver of suspend function  

Reports calls and accesses of CoroutineScope extensions or members inside suspend functions with CoroutineScope receiver.

Ambiguous non-local 'break' or 'continue'  

Reports break or continue usages inside of lambdas of loop-like functions.

Ambiguous unary operator use with number constant  

Reports an unary operator followed by a dot qualifier such as -1.

Array property in data class  

Reports properties with an Array type in a data class without overridden equals() or hashCode().

Arrays comparison via '==' and '!='  

Reports usages of == or != operator for arrays that should be replaced with contentEquals().

Augmented assignment creates a new collection under the hood  

Reports augmented assignment (+=) expressions on a read-only Collection.

Constant conditions  

Reports non-trivial conditions and values that are statically known to be always true, false, null or zero.

Constructor can never be complete  

Reports constructors with a non-null self-reference parameter.

Control flow with empty body  

Reports if, while, do or for statements with empty bodies.

Convert 'object' to 'data object'  

Reports object that can be converted to data object.

Convert equality check with 'NaN' to 'isNaN' call  

Reports an equality check with Float.

Covariant 'equals()'  

Reports equals() that takes an argument type other than Any? if the class does not have another equals() that takes Any? as its argument type.

Delegating to 'var' property  

Reports interface delegation to a var property.

Existing backing field without assignment  

Reports property setters that don't update the backing field.

Extension property conflicting with synthetic one  

Reports extension properties that conflict with synthetic ones that have been automatically produced from Java get or set methods.

External interface contains non-nullable boolean property  

Reports non-nullable boolean properties in external interface.

External interface contains val property  

Reports not var properties in external interface.

Implicit 'Nothing?' type  

Reports variables and functions with the implicit Nothing? type.

Implicit (unsafe) cast from dynamic type  

Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type.

Incomplete destructuring declaration  

Reports incomplete destructuring declaration.

Iterated elements are not used in forEach  

Reports forEach loops that do not use iterable values.

Leaking 'this' in constructor  

Reports unsafe operations with this during object construction including: Accessing a non-final property during class initialization: from a constructor or property initialization Calling a non-final function during class initialization Using this as a function argument in a constructor of a non-final class If other classes inherit from the given class, they may not be fully initialized at the moment when an unsafe operation is carried out.

Main function should return 'Unit'  

Reports when a main function does not have a return type of Unit.

Private data class constructor is exposed via the 'copy' method  

Reports the private primary constructor in data classes.

Range with start greater than endInclusive is empty  

Reports ranges that are empty because the start value is greater than the endInclusive value.

Recursive equals call  

Reports recursive equals(==) calls.

Recursive property accessor  

Reports recursive property accessor calls which can end up with a StackOverflowError.

Redundant assignment  

Reports assignments of a variable to itself.

Sealed subclass without state and overridden equals  

Reports direct inheritors of sealed classes that have no state and overridden equals() method.

Serializable object must implement 'readResolve'  

Reports objects (data object including) that implement java.

Suspicious 'var' property: its setter does not influence its getter result  

Reports var properties with default setter and getter that do not reference backing field.

Suspicious callable reference used as lambda result  

Reports lambda expressions with one callable reference.

Suspicious combination of == and ===  

Reports == and === comparisons that are both used on the same variable within a single expression.

Throwable not thrown  

Reports instantiations of Throwable or its subclasses, when the created Throwable is never actually thrown.

Unresolved reference in KDoc  

Reports unresolved references in KDoc comments.

Unused equals expression  

Reports unused equals(==) expressions.

Unused result of data class copy  

Reports calls to data class copy function without using its result.

Unused return value of a function with lambda expression body  

Reports calls with an unused return value when the called function returns a lambda from an expression body.

Unused unary operator  

Reports unary operators for number types on unused expressions.

Useless call on collection type  

Reports filter… calls from the standard library on already filtered collections.

Useless call on not-null type  

Reports calls on not-null receiver that make sense only for nullable receiver.

Variable in destructuring declaration uses name of a wrong data class property  

Reports entries of destructuring declarations that match the name of a different property of the destructured data class.

Last modified: 29 April 2024