'public' function exposes its 'internal' parameter type...
Copy code
internal interface Cache
// Public API
class API(private val cache: Cache) { // compile error --> 'public' function exposes its 'internal' parameter type
// Cache is not exposed, just used internally
}
Cache
is not part of the public API but it is used in the class that represents the public API (public API of the library/module). What options do I have?
z
Zach Klippenstein (he/him) [MOD]
12/01/2021, 12:35 AM
It’s complaining because the
API
constructor is public, which means anyone can see and call the method, but they’d be required to pass in an instance of a type that they can’t see. You could make the constructor internal.
l
Lilly
12/01/2021, 12:39 AM
You saved my day @Zach Klippenstein (he/him) [MOD] ❤️