Kotlin
Redundant 'inner' modifier
Warning
New
Last modified: 03 December 2024 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]
}
}
}
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
RedundantInnerClassModifier
Here you can find the description of settings available for the Redundant 'inner' modifier inspection, and the reference of their default values.
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Kotlin, 243.23126-IJ |
Thanks for your feedback!
Was this page helpful?