Back to Intellij Community

SetterBackingFieldAssignment

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

2025.3-rc-2360 B
Original Source

Reports property setters that don't update the backing field.

The quick-fix adds an assignment to the backing field.

Example:

class Test {
      var foo: Int = 1
          set(value) {
          }
  }

After the quick-fix is applied:

class Test {
      var foo: Int = 1
          set(value) {
              field = value
          }
  }