/* * @test /nodynamiccopyright/ * @bug 8177466 * @summary Add compiler support for local variable type-inference * @compile/fail/ref=BadLocalVarInferenceTest.out -XDrawDiagnostics BadLocalVarInferenceTest.java */ class BadLocalVarInferenceTest { interface Foo { void m(X x); } interface Supplier { void m(X x); } void test() { var x; var f = () -> { }; var m = this::l; var g = null; var d = d = 1; var k = { 1 , 2 }; var l = new Foo<>() { //LHS was Foo @Override void m(String s) { } }; var s = f(x -> { x.charAt(0); }); //LHS was String } Z f(Supplier sz) { return null; } }