Back to Intellij Community

RedundantCompanionReference

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

2025.3-rc-2355 B
Original Source

Reports redundant Companion reference.

Example:

class A {
      companion object {
          fun create() = A()
      }
  }
  fun test() {
      val s = A.Companion.create()
  }

After the quick-fix is applied:

class A {
      companion object {
          fun create() = A()
      }
  }
  fun test() {
      val s = A.create()
  }