Is there a chance that `@file:Suppress("INVISIBLE_...
# language-evolution
e
Is there a chance that
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
will ever stop working for accessing
internal
members of another module?
y
Maybe, but if it does, you can always use reflection. If this is in relation to the internal kotlin annotations btw, there's a trick to define them in your own module that is as future-proof as it gets.
a
What is the trick ?
e
The trick is to define them in your module using the same package as the official ones. Tooling that uses them typically just looks at the FQN.
👍 1
a
Good to know !
l
Will it be possible to get a
@JvmPrivate
annotation for `internal`s that can be made private on the JVM, for security reasons?
y
Not sure what you mean by security. @JvmSynthetic is close to what you're looking for.
l
I mean, keep things that would be
private
in Java but are
internal
in Kotlin inaccessible to Java (because there are cases where
private
is forbidden in Kotlin, and allowed in Java/JVM Bytecode) -- as
private
is one of if not the only real way to prevent other stuff from calling methods
y
@JvmSynthetic
hides the declaration from Java completely, other languages (like Scala) might see it though.
l
Exactly, I mean hide from JVM bytecode, which is what
private
does.
y
If you mean that you want it to not exist in the bytecode at all, then you actually want
@kotlin.internal.InlineOnly
I think.
l
no no no
I mean, exist, but not callable
private
stuff on the JVM can only be called by specific things. Kotlin prevents it from being used in some cases.
e
aside from the new nestmates feature, what is something that could be
private
but Kotlin doesn't allow?
note that Java will actually do the opposite: some things marked
private
in code may actually gain package-private bridges in bytecode, if it is accessed from an outer or inner class
l
@ephemient wait, really? I didn't know that. My bad. Lemme change my question --- will it be possible to get
@JvmPackagePrivate
for `internal`s that can be made package-private?