langtools/test/tools/javac/generics/inference/8157149/T8157149a.java
author mcimadamore
Mon, 23 May 2016 15:07:10 +0100
changeset 38538 8bdc63ff6961
permissions -rw-r--r--
8157149: Inference: weird propagation of thrown inference variables Summary: Overhaul of treatment of thrown inference variables Reviewed-by: vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38538
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
     1
/*
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
     3
 * @bug 8157149
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
     4
 * @summary Inference: weird propagation of thrown inference variables
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
     5
 *
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
     6
 * @compile/fail/ref=T8157149a.out -XDrawDiagnostics T8157149a.java
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
     7
 */
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
     8
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
     9
import java.io.IOException;
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    10
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    11
class T8157149a {
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    12
   <Z extends Throwable> Z m_T() throws Z { return null; }
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    13
   <Z extends Exception> Z m_E() throws Z { return null; }
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    14
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    15
   void test_T() {
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    16
       Throwable t1 = m_T();
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    17
       Exception t2 = m_T();
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    18
       RuntimeException t3 = m_T();
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    19
       IOException t4 = m_T(); //thrown not caught
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    20
   }
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    21
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    22
   void test_E() {
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    23
       Throwable t1 = m_E();
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    24
       Exception t2 = m_E();
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    25
       RuntimeException t3 = m_E();
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    26
       IOException t4 = m_E(); //thrown not caught
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    27
   }
8bdc63ff6961 8157149: Inference: weird propagation of thrown inference variables
mcimadamore
parents:
diff changeset
    28
}