ThrowsIntersection_1.java revision 0:9a66ca7c79fa
1178354Ssam/*
2178354Ssam * Copyright 2000 Sun Microsystems, Inc.  All Rights Reserved.
3178354Ssam * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4178354Ssam *
5178354Ssam * This code is free software; you can redistribute it and/or modify it
6178354Ssam * under the terms of the GNU General Public License version 2 only, as
7178354Ssam * published by the Free Software Foundation.
8178354Ssam *
9178354Ssam * This code is distributed in the hope that it will be useful, but WITHOUT
10178354Ssam * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11178354Ssam * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12178354Ssam * version 2 for more details (a copy is included in the LICENSE file that
13178354Ssam * accompanied this code).
14178354Ssam *
15178354Ssam * You should have received a copy of the GNU General Public License version
16178354Ssam * 2 along with this work; if not, write to the Free Software Foundation,
17178354Ssam * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18178354Ssam *
19178354Ssam * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20178354Ssam * CA 95054 USA or visit www.sun.com if you need additional information or
21178354Ssam * have any questions.
22178354Ssam */
23178354Ssam
24178354Ssam/*
25178354Ssam * @test
26178354Ssam * @bug 4042259
27178354Ssam * @summary Check that a class can inherit multiple methods with conflicting throws clauses.
28178354Ssam * @author maddox
29178354Ssam *
30178354Ssam * @compile ThrowsIntersection_1.java
31178354Ssam */
32178354Ssam
33178354Ssamclass Ex1 extends Exception {}
34178354Ssamclass Ex2 extends Exception {}
35178354Ssam
36178354Ssaminterface a {
37178354Ssam  int m1() throws Ex1;
38178354Ssam}
39178354Ssam
40178354Ssaminterface b {
41178354Ssam  int m1() throws Ex2;
42178354Ssam}
43178354Ssam
44178354Ssam// Either order should work
45178354Ssamabstract class c1 implements a, b {}
46178354Ssamabstract class c2 implements b, a {}
47178354Ssam
48178354Ssamclass d extends c1 {
49178354Ssam  public int m1() {
50178354Ssam    return 1;
51257176Sglebius  }
52178354Ssam}
53257241Sglebius
54178354Ssamclass e extends c2 {
55178354Ssam  public int m1() {
56178354Ssam    return 1;
57227293Sed  }
58178354Ssam}
59193115Ssam