Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Inconsistencies with the Java 8 (build 1.8.0_144-b01) interfaces.

Sergio1234Aug 16 2017 — edited Aug 16 2017

When putting static in front of an implementation (defaulting) method in a Java 8 interface,

presently, it is forbidden to use the keyword default alongside static.  Now I now that such

is supposed to default to a new "defaulting" interface method anyway.

Yet by comparison, all Java interfaces are abstract interfaces, yet the Oracle

does not reject an interface declaration with abstract alongside interface.

-default static should at least be compiler allowed in interface methods.

The way things are with non-implementation, non defaulting java 8 interface signatures

is that when there is no visibility modifier specified on an interface method signature declaration,

it seems that (public) gets injected there by java anyway.  To the point where implementing

methods in a normal class won't compile unless they specify public.  Bear in mind

that the idea seems to be that things get imported from within packages, and that

static imports now exist.

-(no modifier) should be allowed by class methods implementing interface method signatures.

as should (protected).

In interfaces, if interface fields are injected to be final anyway,...

-(final) should be required from source code by the compiler.

and, ...

-(no modifier) and (private) should be allowed by the compiler on final fields in interfaces (all interface fields).

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 13 2017
Added on Aug 16 2017
0 comments
471 views