Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why Is Intellij Suggesting I Make A Private Field Private in Kotlin?

Why is Intellij suggesting I make a private field private? Am I not understanding this correctly or is it just a bug? I have posted a picture of the error and the decompiled class below. Is this something I should heed or ignore?

enter image description here

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It is a suggestion about the property, not the field. In Java side a property is essentially a field and its accessor methods.

If you changed val s to private val s, the decompiled class would have private visibility for the getS() accessor rather than public.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading