JDK-8042344 : 18.5.4: Need bounds ensuring parameter types are the same
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-05-02
  • Updated: 2017-02-17
  • Resolved: 2015-02-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.
JDK 8
8u40Fixed
Related Reports
Relates :  
Description
For exact method references, 18.5.4 produces these constraints:
"For all j (1 ��� j ��� k), ���Uj = Vj���"

For explicitly typed lambda expressions, the same should occur.  (This was overlooked because it's unnecessary in 15.12.2.5: if a lambda is compatible with two function types, then in the absence of inference variables, the parameter types of all three must be the same.)

JDK-8034223 already addresses this, and adds a test:

interface UnaryOp<T> { T apply(T arg); }
interface IntegerToNumber { Number apply(Integer arg); }

<T> void m(UnaryOp<T> f) {}
void m(IntegerToNumber f) {}

void test() {
    m((Integer i) -> i);
}
Comments
Updated text is straightforward, just adding the following to the top of the "If ei is an explicitly typed lambda expression" bulleted list: For all j (1 ��� j ��� k), ���Uj = Vj���
02-05-2014