Explicit public on static interface methods?

Brian Goetz brian.goetz at oracle.com
Tue May 14 16:50:37 PDT 2013


John Rose made this observation/suggestion:

Implicit public considered risky:  After working for a while on a new 
interface, I realized that all the methods I coded without an explicit 
"public" keyword were still public.  I was using them as package 
privates shared between the interface and some package-private 
implementation logic.  Oops.  Did not discover this until I was 
preparing a javadoc for public review.  That feels a little too late. 
Our processes would block me from accidentally introducing a public 
static, but that might not be true of customers.

Suggest requiring a "public" on "static" interface members.  Will reduce 
confusion if we allow non-public statics in the future.



More information about the lambda-spec-experts mailing list