langtools/test/tools/javac/TryWithResources/TwrAndTypeVariables.java
author jlahoda
Wed, 09 Dec 2015 14:26:56 +0100
changeset 34565 627464b87753
permissions -rw-r--r--
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin Summary: A set of tests using t-w-r as variable in different positive and negative constructions Reviewed-by: abuckley, darcy, jlahoda, sadayapalam Contributed-by: sergei.pikalev@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34565
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     1
/*
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     3
 * @bug 7196163
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     4
 * @summary Twr with resource variables of parametrized types
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     5
 * @compile/fail/ref=TwrAndTypeVariables.out -XDrawDiagnostics TwrAndTypeVariables.java
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     6
 */
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     7
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     8
public class TwrAndTypeVariables {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     9
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    10
    // positive
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    11
    public static <S extends Readable & AutoCloseable,
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    12
                   T extends Appendable & AutoCloseable>
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    13
    void copy(S s, T t) throws Exception {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    14
        try (s; t;) {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    15
        }
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    16
    }
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    17
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    18
    // negative
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    19
    public static <S> void copy(S s) throws Exception {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    20
        try (s) {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    21
        }
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    22
    }
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    23
}