Inspectopedia Help

Convert to primary constructor

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


class User { val name: String constructor(name: String) { = 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


Kotlin, @snapshot@

Last modified: 13 July 2023