Compiler support for private interface methods.

Alex Buckley alex.buckley at oracle.com
Mon Jan 30 19:22:26 UTC 2017


On 1/28/2017 7:09 PM, Manish Motwani wrote:
> This is in reference to:
> http://mail.openjdk.java.net/pipermail/jdk9-dev/2015-March/001981.html
>
> Thanks for fixing this!
>
> Is there also a plan to allow "*private static*" fields on interfaces?

Private methods in interfaces were supported by the JVM in Java SE 8, 
and the Java language is catching up with that in Java SE 9. Nothing 
changed for fields in interfaces in Java SE 8, nor in Java SE 9.

>   "public" and "package protected" static fields are already allowed, but
> private static fields can also be useful in default methods on interfaces.

Every field in an interface is public.

Alex


More information about the jdk9-dev mailing list