Nestmates
Andrey Breslav
andrey.breslav at jetbrains.com
Mon Feb 1 06:29:34 UTC 2016
First, I think it might make sense to share the use cases we have for
nestmates in Kotlin (those that will work out):
- same as Java: nested/inner classes
- multi-file classes (this is how we emulate free functions that are
logically direct members of a package in Kotlin)
Now, there's one issue that does not seem entirely clear to me: does this
proposal imply making nested classes truly private? It does not mention
allowing ACC_PRIVATE on classes, so I'm not sure whether this was intended.
In any case it would make sense, I think. I haven't given it much thought
yet, but we could probably legalize the ACC_PRIVATE flag on classes that
have a NestChild entry, and check that they are only accessed from their
nestmates, right?
(This would only work with Java's every-which-way treatment of access
between the nested classes: in Kotlin, for example, nested classes can not
access private members of their enclosing class, but such extra
restrictions don't seem to be a security concern, because all these classes
are in the same compilation unit anyway.)
--
Andrey Breslav
Project Lead of Kotlin
JetBrains
http://kotlinlang.org/
The Drive to Develop
More information about the valhalla-spec-observers
mailing list