aoqi@0: /* aoqi@0: * @test /nodynamiccopyright/ aoqi@0: * @summary smoke test for inference of throws type variables aoqi@0: * @compile/fail/ref=TargetType63.out -XDrawDiagnostics TargetType63.java aoqi@0: */ aoqi@0: class TargetType63 { aoqi@0: aoqi@0: interface F { aoqi@0: void m() throws T; aoqi@0: } aoqi@0: aoqi@0: void g1() { } aoqi@0: void g2() throws ClassNotFoundException { } aoqi@0: void g3() throws Exception { } aoqi@0: aoqi@0: void m1(F fz) throws Z { } aoqi@0: void m2(F fz) throws Z { } aoqi@0: aoqi@0: void test1() { aoqi@0: m1(()->{ }); //ok (Z = RuntimeException) aoqi@0: m1(this::g1); //ok (Z = RuntimeException) aoqi@0: } aoqi@0: aoqi@0: void test2() { aoqi@0: m2(()->{ }); //fail (Z = ClassNotFoundException) aoqi@0: m2(this::g1); //fail (Z = ClassNotFoundException) aoqi@0: } aoqi@0: aoqi@0: void test3() { aoqi@0: m1(()->{ throw new ClassNotFoundException(); }); //fail (Z = ClassNotFoundException) aoqi@0: m1(this::g2); //fail (Z = ClassNotFoundException) aoqi@0: m2(()->{ throw new ClassNotFoundException(); }); //fail (Z = ClassNotFoundException) aoqi@0: m2(this::g2); //fail (Z = ClassNotFoundException) aoqi@0: } aoqi@0: aoqi@0: void test4() { aoqi@0: m1(()->{ throw new Exception(); }); //fail (Z = Exception) aoqi@0: m1(this::g3); //fail (Z = Exception) aoqi@0: } aoqi@0: }