langtools/test/tools/javac/generics/inference/CheckNoTimeoutException.java
changeset 36278 f74f056dc069
equal deleted inserted replaced
36277:9ac0af8efac2 36278:f74f056dc069
       
     1 /*
       
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 /**
       
    25  * @test
       
    26  * @bug 8148930
       
    27  * @summary Verify that there is no spurious unreported exception error.
       
    28  * @modules java.sql
       
    29  * @compile CheckNoTimeoutException.java
       
    30  */
       
    31 
       
    32 import java.util.Collection;
       
    33 import java.util.List;
       
    34 import java.util.ArrayList;
       
    35 import java.util.concurrent.TimeoutException;
       
    36 import java.io.*;
       
    37 import java.sql.SQLException;
       
    38 import java.sql.SQLTransientException;
       
    39 
       
    40 class CheckNoTimeoutException {
       
    41 
       
    42     interface V {List<?> foo(List<String> arg) throws EOFException, SQLException, TimeoutException;}
       
    43     interface U {Collection foo(List<String> arg) throws IOException, SQLTransientException;}
       
    44 
       
    45     //SAM type ([List<String>], List<String>/List, {EOFException, SQLTransientException})
       
    46     interface UV extends U, V {}
       
    47 
       
    48 
       
    49     private static List<String> strs = new ArrayList<String>();
       
    50     void methodUV(UV uv) {
       
    51         System.out.println("methodUV(): SAM type interface UV object instantiated: " + uv);
       
    52         try{
       
    53             System.out.println("result returned: " + uv.foo(strs));
       
    54         }catch(EOFException e){
       
    55             System.out.println(e.getMessage());
       
    56         }catch(SQLTransientException ex){
       
    57             System.out.println(ex.getMessage());
       
    58         }
       
    59     }
       
    60 }