Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/exceptions/UnboundExceptions.java
anna 481bc252f3 switch tests on new inference
(cherry picked from commit d2cbf3f2833104c3a0381059b0d6ef8ac0b3c94c)
2013-11-25 16:47:38 +01:00

30 lines
1.2 KiB
Java

class Test {
interface F<T extends Throwable> {
void _() throws T;
}
void m1() { }
void m2() throws ClassNotFoundException { }
void m3() throws Exception { }
<K extends Throwable> void foo1(F<K> f) throws K { }
<K extends ClassNotFoundException> void foo2(F<K> f) throws K { }
{
<error descr="Unhandled exception: java.lang.ClassNotFoundException">foo2(()->{});</error>
<error descr="Unhandled exception: java.lang.ClassNotFoundException">foo2(()->{ throw new ClassNotFoundException(); });</error>
<error descr="Unhandled exception: java.lang.ClassNotFoundException">foo2(this::m1);</error>
<error descr="Unhandled exception: java.lang.ClassNotFoundException">foo2(this::m2);</error>
foo1(()->{ <error descr="Unhandled exception: java.lang.ClassNotFoundException">throw new ClassNotFoundException();</error> });
foo1(()->{ <error descr="Unhandled exception: java.lang.Exception">throw new Exception();</error> });
<error descr="Unhandled exception: java.lang.ClassNotFoundException">foo1(this::m2);</error>
<error descr="Unhandled exception: java.lang.Exception">foo1(this::m3);</error>
}
}