protected
methods clone()
and finalize()
in java.lang.Object
.
In an interface it is possible to declare those methods with a return type that is incompatible with the java.lang.Object
methods.
This makes it impossible to create a class implementing such an interface.
When the interface is functional it remains possible to create a lambda from it, but this can still be confusing.
Example:
// Warning: this interface cannot be implemented by any class, // only by lambda or method reference interface MyInterface { double clone(); }New in 2016.1