Default visibility rules


Checked the kotlin reference but haven’t found information about default class/class members visbility rules, e.g. is it guaranteed that a class declared like below will be public?

data class Text(val startOffset : Int, val endOffset : Int) : Setting()

Please clarify.

Regards, Denis

By default, everything gets visibility internal, which is "visible inside the same module". "Public" should be specified explicitly if you want to access something from another module

Thanks, it's worth to reflect that at the reference as well


Are you sure?

How come ctrl+o or ctrl+i for public methods don’t add “public” then?

I have been adding “public” manually for overrides, but it seems to work without it.
Is that a bug or something specific to overrides?

When you override a member, you don't have to specify visibility, it will be inherited from the base class by default.