I understand why java doesn't allow to set weaker access privileges for overridden methods, but why is it the same for static methods? I mean, these methods only hide each others, right? So what's the problem from the encapsulation point of view?
P.S.
I know that there are 5 rules for hiding a method
- The method in the child class must have the same signature as the method in the parent
class.
- The method in the child class must be at least as accessible or more accessible than the
method in the parent class.
- The method in the child class may not throw a checked exception that is new or
broader than the class of any exception thrown in the parent class method.
- If the method returns a value, it must be the same or a subclass of the method in the
parent class, known as co-variant return types.
- The method defined in the child class must be marked as static if it is marked as
static in the parent class (method hiding). Likewise, the method must not be marked
as static in the child class if it is not marked as static in the parent class (method
overriding).
But after all, I don't get the idea from the encapsulation prospective
The same rules are valid and for method hiding
https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.8.3