ThrowsIntersection_1.java revision 0:9a66ca7c79fa
1144847Salc/*
2144847Salc * Copyright 2000 Sun Microsystems, Inc.  All Rights Reserved.
3144847Salc * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4144847Salc *
5144847Salc * This code is free software; you can redistribute it and/or modify it
6144847Salc * under the terms of the GNU General Public License version 2 only, as
7144847Salc * published by the Free Software Foundation.
8144847Salc *
9144847Salc * This code is distributed in the hope that it will be useful, but WITHOUT
10144847Salc * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11144847Salc * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12144847Salc * version 2 for more details (a copy is included in the LICENSE file that
13144847Salc * accompanied this code).
14144847Salc *
15144847Salc * You should have received a copy of the GNU General Public License version
16144847Salc * 2 along with this work; if not, write to the Free Software Foundation,
17144847Salc * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18144847Salc *
19144847Salc * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20144847Salc * CA 95054 USA or visit www.sun.com if you need additional information or
21144847Salc * have any questions.
22144847Salc */
23144847Salc
24144847Salc/*
25144847Salc * @test
26144847Salc * @bug 4042259
27144847Salc * @summary Check that a class can inherit multiple methods with conflicting throws clauses.
28144847Salc * @author maddox
29144847Salc *
30144847Salc * @compile ThrowsIntersection_1.java
31144847Salc */
32144847Salc
33144847Salcclass Ex1 extends Exception {}
34144847Salcclass Ex2 extends Exception {}
35144847Salc
36144847Salcinterface a {
37144847Salc  int m1() throws Ex1;
38144847Salc}
39144847Salc
40144847Salcinterface b {
41144847Salc  int m1() throws Ex2;
42144847Salc}
43144847Salc
44144847Salc// Either order should work
45144847Salcabstract class c1 implements a, b {}
46144847Salcabstract class c2 implements b, a {}
47144847Salc
48144847Salcclass d extends c1 {
49144847Salc  public int m1() {
50144847Salc    return 1;
51144847Salc  }
52144847Salc}
53144847Salc
54144847Salcclass e extends c2 {
55144847Salc  public int m1() {
56144847Salc    return 1;
57144847Salc  }
58144847Salc}
59144847Salc