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]
}
}
}
Locating this inspection
- 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- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Inspection options
Here you can find the description of settings available for the Redundant 'inner' modifier inspection, and the reference of their default values.
- Ignore if annotated by
[org.junit.jupiter.api.Nested]
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Kotlin, 242.22892-IJ |
Last modified: 11 September 2024