What is an open property? Why I can't make its setter to private?

Viewed 2178

What is the difference between a Property and Open Property in Kotlin? The code below complains on me declaring the setter private and Intellij says private setters are not allowed for open properties. What is an open property?

@RestController
open class ParameterController {

  @Autowired
  lateinit var parameterRepository: ParameterRepository
    private set //error


}

Why is the code above not valid but this code is?

open class ItemPrice{

    lateinit var type: String
        private set // ok

}

EDIT: I am using the spring-allopen plugin, and marking the class explicitly as open doesn't make a difference.

1 Answers
Related