Inspectopedia Help

Join declaration and assignment

Reports property declarations that can be joined with the following assignment.

Example:

val x: String x = System.getProperty("")

The quick fix joins the declaration with the assignment:

val x = System.getProperty("")

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.

JoinDeclarationAndAssignment
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 | Style issues

Configure the inspection:

You can disable the option Report with complex initialization of member properties to skip properties with complex initialization. This covers two cases:

  1. The property initializer is complex (it is a multiline or a compound/control-flow expression)

  2. The property is first initialized and then immediately used in subsequent code (for example, to call additional initialization methods)

Inspection options

Here you can find the description of settings available for the Join declaration and assignment inspection, and the reference of their default values.

Report with complex initialization of member properties

Default: Selected

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.2, Qodana for JVM 2024.2,

Can be installed with plugin:

Kotlin, 242.22892-IJ

Last modified: 11 September 2024