Hi! I was wondering how other people handle sharin...
# language-evolution
r
Hi! I was wondering how other people handle sharing internal code across modules without leaking it to the public API. I'm currently working on a Gradle plugin, and I have constants that are shared between multiple modules but I'd rather not have exposed to the end user. I wish there was a way to have something akin to the
internal
modifier but with the possibility to scope to multiple modules. I figure it's probably a niche request so I was wondering how other people have handled the situation.
m
We have
@ApolloInternal
(code). It's not bullet proof but it's something.
1
Another solution is to tinker with
-Xfriend-path
to have your modules access each other's
internal
symbols (blog post)
Beware in that last case that all the libs are aligned. If not you risk binary incompatibilities if you change some internal symbols
e
w
(Interstingly, Swift has package modifier for this)