test/tools/javac/TryWithResources/TwrIntersection02.java

changeset 840
7f8794f9cc14
parent 839
a8437c34fdc7
child 841
df371fd16386
     1.1 --- a/test/tools/javac/TryWithResources/TwrIntersection02.java	Mon Jan 24 16:38:56 2011 -0800
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,37 +0,0 @@
     1.4 -/*
     1.5 - * @test  /nodynamiccopyright/
     1.6 - * @bug 6911256 6964740 6965277
     1.7 - * @author Maurizio Cimadamore
     1.8 - * @summary Check that resources of an intersection type forces union of exception types
     1.9 - *          to be caught outside twr block
    1.10 - * @compile/fail/ref=TwrIntersection02.out -XDrawDiagnostics TwrIntersection02.java
    1.11 - */
    1.12 -
    1.13 -class TwrIntersection02 {
    1.14 -
    1.15 -    static class Exception1 extends Exception {}
    1.16 -    static class Exception2 extends Exception {}
    1.17 -
    1.18 -
    1.19 -    interface MyResource1 extends AutoCloseable {
    1.20 -       void close() throws Exception1;
    1.21 -    }
    1.22 -
    1.23 -    interface MyResource2 extends AutoCloseable {
    1.24 -       void close() throws Exception2;
    1.25 -    }
    1.26 -
    1.27 -    public void test1() throws Exception1 {
    1.28 -        try(getX()) {
    1.29 -            //do something
    1.30 -        }
    1.31 -    }
    1.32 -
    1.33 -    public void test2() throws Exception2 {
    1.34 -        try(getX()) {
    1.35 -            //do something
    1.36 -        }
    1.37 -    }
    1.38 -
    1.39 -    <X extends MyResource1 & MyResource2> X getX() { return null; }
    1.40 -}

mercurial