|
1 /* |
|
2 * @test /nodynamiccopyright/ |
|
3 * @bug 6723444 |
|
4 * |
|
5 * @summary javac fails to substitute type variables into a constructor's throws clause |
|
6 * @author Mark Mahieu |
|
7 * @compile/fail/ref=T6723444_1.out -Xlint:-options -source 7 -XDrawDiagnostics T6723444.java |
|
8 * @compile/fail/ref=T6723444_2.out -XDrawDiagnostics T6723444.java |
|
9 * |
|
10 */ |
|
11 public class T6723444 { |
|
12 |
|
13 static class Foo<X extends Throwable> { |
|
14 Foo() throws X {} |
|
15 } |
|
16 |
|
17 <X extends Throwable> T6723444() |
|
18 throws X {} |
|
19 |
|
20 <X extends Throwable> T6723444(Foo<X> foo) |
|
21 throws X {} |
|
22 |
|
23 <X1 extends Throwable, X2 extends Throwable> T6723444(Foo<X1> foo, int i) |
|
24 throws X1, X2 {} |
|
25 |
|
26 public static void main(String[] args) throws Exception { |
|
27 |
|
28 // the following 8 statements should compile without error |
|
29 |
|
30 Foo<Exception> exFoo = new Foo<Exception>(); |
|
31 exFoo = new Foo<Exception>() {}; |
|
32 |
|
33 new<Exception> T6723444(); |
|
34 new<Exception> T6723444() {}; |
|
35 new T6723444(exFoo); |
|
36 new T6723444(exFoo) {}; |
|
37 new<Exception, Exception> T6723444(exFoo, 1); |
|
38 new<Exception, Exception> T6723444(exFoo, 1) {}; |
|
39 |
|
40 // the remaining statements should all raise an |
|
41 // unreported exception error |
|
42 |
|
43 new T6723444(exFoo, 1); |
|
44 new T6723444(exFoo, 1) {}; |
|
45 |
|
46 Foo<Throwable> thFoo = new Foo<Throwable>(); |
|
47 thFoo = new Foo<Throwable>() {}; |
|
48 |
|
49 new<Throwable> T6723444(); |
|
50 new<Throwable> T6723444() {}; |
|
51 new T6723444(thFoo); |
|
52 new T6723444(thFoo) {}; |
|
53 new T6723444(thFoo, 1); |
|
54 new T6723444(thFoo, 1) {}; |
|
55 new<Throwable, Throwable> T6723444(thFoo, 1); |
|
56 new<Throwable, Throwable> T6723444(thFoo, 1) {}; |
|
57 } |
|
58 } |