Summary
-------
The javac compiler should not accept private method references with a type variable receiver.
Problem
-------
JLS 4.4 specifies that:
The members of a type variable X with bound T & I 1 & ... & I n are the members of
the intersection type (ยง4.9) T & I 1 & ... & I n appearing at the point where the type
variable is declared.
So code like:
import java.util.function.*;
class Test {
private String asString() {
return "bar";
}
static <T extends Test> Function<T, String> foo() {
return T::asString;
}
}
should be rejected by javac as private method `asString` is not a member of type variable `T`
Solution
--------
The proposed solution is to sync javac with the specification so that private method references with type variable receiver are rejected by javac
Specification
-------------
No specification changes are required.