Hi all , Why doesn’t kotlin allow having a interna...
# android
a
Hi all , Why doesn’t kotlin allow having a internal class as a constructor parameter which is marked as private val in a public class. For example
Copy code
internal interface Mapper

class UseCase(private val mapper)
Why does compiler say ‘public’ function exposes its ‘internal’ parameter type when it is a
private val mapper
c
UseCase
's constructor is public, so it can be called outside your module. However,
Mapper
is internal, so it can't be used outside your module. The result is that it's not possible to call the constructor outside the module. You can make
UseCase
's constructor internal:
Copy code
class UseCase internal constructor(private val mapper: Mapper)
☝️ 1
🙌 1
a
Thanks @CLOVIS