Any other way of marking internal APIs in interfaces?
Copy code
interface IFoo {
@Suppress("DEPRECATION")
@RequiresOptIn(
level = RequiresOptIn.Level.ERROR,
message = "This API is DANGEROUS, internal and should not be used. It could be removed or changed without notice."
)
@Experimental(level = Experimental.Level.ERROR)
@Target(
AnnotationTarget.PROPERTY
)
annotation class DangerousInternalAPI
@DangerousInternalAPI
val internalState: MutableMap<KType, Any>
m
Marcus Brito
10/26/2021, 1:26 PM
That’s basically what the
internal
access modifier is for
m
Mihai Voicescu
10/26/2021, 1:35 PM
Yes, but you can't make a method/field internal in an interface
m
Marcus Brito
10/26/2021, 1:49 PM
what about defining a separate internal interface?
m
Mihai Voicescu
10/26/2021, 1:52 PM
Thought about that, but I need to make inline methods on the public interface to use refined and they need access to the internal interface, so I end right back where I started 😢
Mihai Voicescu
10/26/2021, 1:55 PM
Or maybe I am missing something 🙂
m
Marcus Brito
10/26/2021, 1:58 PM
maybe this shouldn’t be an interface at all, considering the amount of implementation it’s offering