Inspectopedia Help

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.

Settings or Preferences | Editor | Inspections | Kotlin | Redundant constructs

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]

Availability

By default bundled with

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin

Kotlin, 241.18072-IJ

Last modified: 18 June 2024