JDK-8177361 : Release Note: Default methods affect the result of Class.getMethod and Class.getMethods
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 8u20
  • Priority: P2
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2017-03-22
  • Updated: 2022-06-14
  • Resolved: 2017-03-23
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.
JDK 8
8u20Resolved
Related Reports
Relates :  
Description
The javadoc for the Class.getMethod and Class.getMethods refer to the definition of inheritance in the Java Language Specification. Java SE 8 changed these rules in order to support default methods and reduce the number of redundant methods inherited from superinterfaces (see JLS 8, 8.4.8).

Class.getMethod and Class.getMethods were not updated with the 8 release to match the new inheritance definition (both may return non-inherited superinterface methods). Typically, the distinction is of no consequence; and for compatibility, it is preferred that the identity and number of returned methods match Java SE 7 as closely as possible. However, when the overriding method is a default method, it is important to filter out other overridden methods. As of 8u20, the implementation has been changed to perform this filtering step when the overrider is a default method.
Comments
Please note that this describes a short-term fix for 8u. The complete fix went into 9 and is documented by JDK-8177360.
23-03-2017