Take the code:
public class A {
public static void main(String[] args) {
new Thread((new I() {})::test);
}
interface I {
private void test() {}
}
}
And try to compile. I receive:
A.java:5: error: invalid method reference
new Thread(((new I() {}))::test);
^
compiler message file broken: key=compiler.misc.cant.resolve.args arguments=method, test, , , {4}, {5}, {6}, {7}
Where compiler message file broken
seems to be something incomprehensible. Is it a bug or I am missing something?
P.S. Submitted a bug: ID : 9052216
Admitted as a bug by the Java Development Support:
https://bugs.openjdk.java.net/browse/JDK-8194997
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With