In Java, the protected
keyword limits the visibility of a field or method to the subclasses and the whole package.
Is there a way to limit the visibility only to subclasses, in a static way (i.e. at compilation time, without integrating runtime access control logic within the method)? In other words, is there a way to simulate the behaviour of a (friendless) C++-like protected
modifier?