JDK-8167318 : Eliminate redundant Types.returnTypeSubstitutable method
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 9
  • Priority: P5
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2016-10-06
  • Updated: 2017-10-16
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
Relates :  
Description
There are two Types.returnTypeSubstitutable methods. They follow slightly different protocols for their inputs, but ultimately compute the same thing*. This is far from obvious, since their bodies do not look alike and pass through a few layers before sharing the same code.

The second one is called by Check.checkOverride, and the first one is used by everything else.

*I _think_ they compute the same thing; they're certainly meant to. Here's a case analysis:

primitives and void:
    isSameType(R1, R2)
reference types, methods have same sig:
    subtypeUnchecked(R1, adapt(R2))
reference types, methods have different sigs: 
    first method: subtypeUnchecked(R1, erase(R2))
    second method: subtypeUnchecked(R1, R2) || subtype(R1, erase(R2))

Comments
Deferred to tbd-minor; that may need to be updated if there are spec changes involved.
25-10-2016

Note that, per JDK-8167316, there are some discrepancies between javac and JLS which may need to be addressed here, or may be handled with spec changes.
06-10-2016