test/tools/javac/defaultMethods/Neg10.java

changeset 1393
d7d932236fee
child 1415
01c9d4161882
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/defaultMethods/Neg10.java	Sun Nov 04 10:59:42 2012 +0000
     1.3 @@ -0,0 +1,20 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @summary check that default overrides are properly type-checked
     1.7 + * @compile/fail/ref=Neg10.out -Werror -Xlint:unchecked -XDallowDefaultMethods -XDrawDiagnostics Neg10.java
     1.8 + */
     1.9 +class Neg10 {
    1.10 +    interface I<X extends Exception> {
    1.11 +        default void m() throws X { }
    1.12 +    }
    1.13 +
    1.14 +    static class C1 {
    1.15 +        public void m() throws Exception { } //unchecked (throws) override
    1.16 +    }
    1.17 +
    1.18 +    static class C2<Z extends Exception> extends C1 implements I<Z> { }
    1.19 +
    1.20 +    static class C3<Z extends Exception> implements I<Z> {
    1.21 +        public void m() throws Exception { } //unchecked (throws) override
    1.22 +    }
    1.23 +}

mercurial