https://kotlinlang.org logo
Title
s

Sam

09/19/2019, 12:54 AM
Is there a visibility modifier between public and internal? This is for a library project with many gradle modules. API usage is meant only for all modules and not external consumers.
🇳🇴 2
n

nfrankel

09/19/2019, 12:55 AM
nope
s

Sam

09/19/2019, 12:56 AM
Okay, is there something similar to Android's @hide for public APIs?
m

Mike

09/19/2019, 11:39 AM
package-private wouldn't help in this case either. All a consumer has to do is put their class into the same package, right? And then they have access that is not desired. I'm not familiar with @hide, but doing some SO research, it appears it merely hides the method(s) from the documentation. Can't get to Dokka docs right now. Does it have something to hide a function from the docs?
s

Sam

09/19/2019, 12:05 PM
Android sdk library build process removes all methods/class marked as @hide
This is a stub jar which is used only for compilation of an app. Eventually, when the app is run on the device, the API call is actually resolved by library loaded by dalvik VM on the device.
This approach obviously doesn't work for new support, android x libraries which aren't stub versions and has the actual implementation.
Looks like some kind of code obfuscation would help