-
Bug
-
Resolution: Unresolved
-
P5
-
9
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))
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))
- relates to
-
JDK-8167316 8.4.5: Clean up return-type-substitutable definition
- Open