Inspectopedia Help

Convert to primary constructor

Reports a secondary constructor that can be replaced with a more concise primary constructor.

Example:

class User { val name: String constructor(name: String) { this.name = name } }

The quick-fix converts code automatically:

class User(val name: String) { }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023