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

**URL:** <https://discuss.kotlinlang.org/t/1-0-rc-private-setters-for-non-private-lateinit-vars-are-prohibited/65>\
**Category:** Uncategorized\
**Created:** [October 23, 2015, 4:22pm UTC](https://discuss.kotlinlang.org/t/1-0-rc-private-setters-for-non-private-lateinit-vars-are-prohibited/65 "2015-10-23T16:22:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukaspili](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lukaspili/32/1458_2.png) [@lukaspili](https://discuss.kotlinlang.org/u/lukaspili)\
**Post date:** [October 23, 2015, 4:22pm UTC](https://discuss.kotlinlang.org/t/1-0-rc-private-setters-for-non-private-lateinit-vars-are-prohibited/65/1 "2015-10-23T16:22:36Z")

</div>

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [October 23, 2015, 4:57pm UTC](https://discuss.kotlinlang.org/t/1-0-rc-private-setters-for-non-private-lateinit-vars-are-prohibited/65/2 "2015-10-23T16:57:35Z")

</div>

To implement a read-only property use **val**'s. The line that you quote is about [**lateinit** properties](https://kotlinlang.org/docs/reference/properties.html#late-initialized-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.

---

<div class="post-metadata">

**Author:** ![lukaspili](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lukaspili/32/1458_2.png) [@lukaspili](https://discuss.kotlinlang.org/u/lukaspili)\
**Post date:** [October 23, 2015, 5:17pm UTC](https://discuss.kotlinlang.org/t/1-0-rc-private-setters-for-non-private-lateinit-vars-are-prohibited/65/3 "2015-10-23T17:17:15Z")

</div>

Thanks for the answer, makes sense!
