Redundant 'inner' modifier
Reports the inner
modifier on a class as redundant if it doesn't reference members of its outer class.
Example:
class Foo {
inner class InnerClass { // redundant `inner` modifier
fun hello() {
println("Hi!")
}
}
}
class List {
val objects = Array<Any>(42) { Any() }
inner class Iterator { // Not redundant `inner` modifier
fun next(): Any {
return objects[0]
}
}
}
After the quick-fix is applied:
class Foo {
class InnerClass { // redundant `inner` modifier
fun hello() {
println("Hi!")
}
}
}
class List {
val objects = Array<Any>(42) { Any() }
inner class Iterator { // Not redundant `inner` modifier
fun next(): Any {
return objects[0]
}
}
}
Inspection options
Option | Type | Default |
---|---|---|
Ignore if annotated by | StringList | [org.junit.jupiter.api.Nested] |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Kotlin, @snapshot@ |
Last modified: 13 July 2023