langtools/test/tools/javac/TryWithResources/TwrVarRedeclaration.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 Variable redeclaration inside twr block
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
     5
 * @compile/fail/ref=TwrVarRedeclaration.out -XDrawDiagnostics TwrVarRedeclaration.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 TwrVarRedeclaration implements AutoCloseable {
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
    public static void main(String... args) {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    11
        TwrVarRedeclaration r = new TwrVarRedeclaration();
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    12
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    13
        try (r) {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    14
            TwrVarRedeclaration r = new TwrVarRedeclaration();
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
        try (r) {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    18
            Object r = new Object();
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    19
        }
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    20
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    21
        try (r) {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    22
        } catch (Exception e) {
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    23
            Exception r = new Exception();
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    24
        }
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    25
    }
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    26
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    27
    public void close() {}
627464b87753 8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff changeset
    28
}