why do interface members have to be public ?
# announcements
l
why do interface members have to be public ?
e
that's now Java works. unclear how anything else would make sense.
private methods must be non-abstract and cannot be overridden - doesn't fit in an interface
protected methods can only be called by inheritors - just define the method in first implementing base class, it will be available to all inheritors
l
what about internal ?
r
If a member is for internal use, it doesn't make much sense to declare it as part of it's public interface.
e
you can make an internal interface, if you want. but note that all supertypes are part of your public ABI, even if they're "internal"
n
btw Java 9+ does allow private methods in interfaces
e
makes more sense in Java, IMO. they're there to be callable from the default implementations, but they could just as well be top-level functions in Kotlin - you can't store any state either way
👍 1