Inspectopedia Help

Obvious explicit type

Reports local variables' explicitly given types which are obvious and thus redundant, like val f: Foo = Foo().

Example:

class Point(val x: Int, val y: Int) fun foo() { val t: Boolean = true val p: Point = Point(1, 2) val i: Int = 42 }

After the quick-fix is applied:

class Point(val x: Int, val y: Int) fun foo() { val t = true val p = Point(1, 2) val i = 42 }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023