Reputation: 661
I have an open
(or abstract
) public
class
that contains an open
(or abstract
) fun
(or var
or val
) that I do not want to expose as public
.
Unfortunately I also need to call that fun
from inside my current package.
If I mark it as internal
that class cannot be inherited correctly from another package(ide gives warning: inherits invisible abstract members), if I mark it as protected
the fun cannot be access from inside the current package
Any way to bypass this?
Upvotes: 3
Views: 503
Reputation: 661
A dirty way is to add a proxy internal method and call that method inside your package:
abstract class AbstractClass {
protected abstract fun isTrue(int: Int): Boolean
internal fun isTrueInternalProxy(int: Int): Boolean {
return isTrue(int)
}
}
Upvotes: 3