Explicit public on static interface methods?
ali.ebrahimi1781 at gmail.com
Wed May 15 00:20:42 PDT 2013
Please don't change default accessibility for interfaces or classes. this
conventions comes from java 1.0 days.
if we want some day (java 9) to allow (static or non-static) non-public
members in interfaces make them explicit. for this we can add 'package'
keyword to modifier lists.
On Wed, May 15, 2013 at 4:20 AM, Brian Goetz <brian.goetz at oracle.com> 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
> 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-observers