Java 9 allows us to have private
methods in interface, which means that not explicitly marking public
methods is no longer superfluous.
However, is it now mandatory to do so? I hope the specification still assumes public abstract
as the default modifier for methods to maintain backward compatibility with earlier source code?
The Java 9 Language Specification says in §9.4::
A method in the body of an interface may be declared
public
orprivate
(§6.6). If no access modifier is given, the method is implicitlypublic
. It is permitted, but discouraged as a matter of style, to redundantly specify thepublic
modifier for a method declaration in an interface.
Unfortunately, I can't find a link that does not lead to a PDF, diffing the old and new JLS.