JDK-8154588 : Error expected for declaring a 'clone' default method
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8u60,9
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2016-04-19
  • Updated: 2017-02-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorUnresolved
Related Reports
Duplicate :  
Relates :  
Description
This declaration compiles without error:

  interface I1 {
    default Object clone() { return this; }
  }

Per JLS 9.4.1.2, an error is expected: the default method is override-equivalent with Object.clone, a non-private method of class Object.
Comments
Been looking at this in the context of JDK-8155221;I'll quote the comment there for future references: "This seems a bug in the routine Types.overridesObjectMethod - it uses MethodSymbol.overrides, which fails if the modifier of the overridden method is not public and we are inside an interface. The check should be rewritten in terms of a more neutral routine, such as Types.overrideEquivalent. "
17-08-2016