8afd89977c
Allow diamond inference in combination with anonymous class instance creation Co-authored-by: Maurizio Cimadamore <maurizio.cimadamore@oracle.com> Reviewed-by: mcimadamore, vromero
22 lines
658 B
Java
22 lines
658 B
Java
/*
|
|
* @test /nodynamiccopyright/
|
|
* @bug 8062373
|
|
* @summary Test that the anonymous class constructor appears to returns a Foo<T>, when it actually returns a Anon$1. (status as of now - may change in future)
|
|
* @compile/fail/ref=Neg17.out Neg17.java -XDrawDiagnostics
|
|
*/
|
|
|
|
import java.util.Collections;
|
|
|
|
abstract class Neg17<T> {
|
|
|
|
abstract void m();
|
|
|
|
public static void main(String[] args) {
|
|
Collections.singletonList(new Neg17<>() { void m() {} }).get(0).m(); // good.
|
|
Collections.singletonList(new Neg17<>() {
|
|
void m() {}
|
|
private void n() {}
|
|
}).get(0).n(); // bad unknown method n()
|
|
}
|
|
}
|