T8157149a.java revision 3427:a8b7c9938b74
1/*
2 * @test /nodynamiccopyright/
3 * @bug 8157149
4 * @summary Inference: weird propagation of thrown inference variables
5 *
6 * @compile/fail/ref=T8157149a.out -XDrawDiagnostics T8157149a.java
7 */
8
9import java.io.IOException;
10
11class T8157149a {
12   <Z extends Throwable> Z m_T() throws Z { return null; }
13   <Z extends Exception> Z m_E() throws Z { return null; }
14
15   void test_T() {
16       Throwable t1 = m_T();
17       Exception t2 = m_T();
18       RuntimeException t3 = m_T();
19       IOException t4 = m_T(); //thrown not caught
20   }
21
22   void test_E() {
23       Throwable t1 = m_E();
24       Exception t2 = m_E();
25       RuntimeException t3 = m_E();
26       IOException t4 = m_E(); //thrown not caught
27   }
28}
29