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