Request for review: proposal for @FunctionalInterface checking

Sam Pullara sam at sampullara.com
Fri Dec 28 12:28:52 PST 2012


On Dec 28, 2012, at 3:02 PM, Joe Darcy <joe.darcy at oracle.com> wrote:
> has exactly one abstract method.  Since default methods are not abstract, any default methods declared in an interface do not contribute to its abstract method count.  If an interface declares a method overriding one of the public methods of java.lang.Object, that also does <em>not</em> count toward the abstract method count.

This is pretty murky. This works:

interface Foo {
  @Override
  boolean equals(Object other);
}

but if you try this

interface Foo {
  @Override
  default boolean equals(Object other) {
    return false;
  }
}

it does give an error that says I can't override:

java: default method equals in interface spullara.Foo overrides a member of java.lang.Object

Seems like "override" is the wrong word to use and will likely be confusing since we are explicitly disallowing the second one.

Sam

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/lambda-libs-spec-experts/attachments/20121228/2ae02b60/attachment.html 


More information about the lambda-libs-spec-experts mailing list