1.0 RC: Private setters for non-private lateinit vars are prohibited

Hello, I noticed the following change in the new 1.0 RC: "Private setters for non-private lateinit vars are prohibited" Cannot find anywhere any explanation why.

Coming from Java, I’m looking to have public ready-only properties, so my reflex was to set the setter as private, which is not working anymore.
Can you explain why, and what’s the recommended way to implement public ready-only properties?


To implement a read-only property use val's. The line that you quote is about lateinit properties that can not be val's, because val's are final and must be initialized in constructor, which is the exact opposite of lateinit.

Why lateinit var's can’t have private setters: because they are exposed as fields to Java, and the privateness of the accessor does not protect anything.

Thanks for the answer, makes sense!