Explicit public on static interface methods?
David Holmes
david.holmes at oracle.com
Tue May 14 17:11:09 PDT 2013
On 15/05/2013 9:50 AM, Brian Goetz wrote:
> 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.
Obviously some education needed that the Java language only supports
public interface members at this time. ;-)
> Suggest requiring a "public" on "static" interface members. Will reduce
> confusion if we allow non-public statics in the future.
Didn't we already paint this bikeshed? Right now we only allow public
members and the convention is that the public is implicit. If we were to
change that then we should change it across the board - there is nothing
special about static methods.
David
More information about the lambda-spec-experts
mailing list