langtools/test/tools/javac/TryWithResources/TwrAndTypeVariables.java
changeset 34565 627464b87753
equal deleted inserted replaced
34564:ce1498f6591f 34565:627464b87753
       
     1 /*
       
     2  * @test /nodynamiccopyright/
       
     3  * @bug 7196163
       
     4  * @summary Twr with resource variables of parametrized types
       
     5  * @compile/fail/ref=TwrAndTypeVariables.out -XDrawDiagnostics TwrAndTypeVariables.java
       
     6  */
       
     7 
       
     8 public class TwrAndTypeVariables {
       
     9 
       
    10     // positive
       
    11     public static <S extends Readable & AutoCloseable,
       
    12                    T extends Appendable & AutoCloseable>
       
    13     void copy(S s, T t) throws Exception {
       
    14         try (s; t;) {
       
    15         }
       
    16     }
       
    17 
       
    18     // negative
       
    19     public static <S> void copy(S s) throws Exception {
       
    20         try (s) {
       
    21         }
       
    22     }
       
    23 }