Back to Intellij Community

RedundantUpperBound

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/RedundantUpperBound.html

2025.3-rc-2400 B
Original Source

Reports redundant explicit upper bound Any? on a type parameter. In Kotlin, the default upper bound for type parameters is Any?, so specifying it explicitly is unnecessary.

Examples:

// Before
fun <T : Any?> foo(t: T) {}
class C<T : Any?>

After the quick-fix is applied:

fun <T> foo(t: T) {}
class C<T>

The quick fix removes the redundant upper bound and the preceding colon.