Maurizio Cimadamore d4be9a13c8 7192246: Add type-checking support for default methods
Add type-checking support for default methods as per Featherweight-Defender document

Reviewed-by: jjg, dlsmith
2012-11-04 10:59:42 +00:00

21 lines
629 B
Java

/*
* @test /nodynamiccopyright/
* @summary check that default overrides are properly type-checked
* @compile/fail/ref=Neg10.out -Werror -Xlint:unchecked -XDallowDefaultMethods -XDrawDiagnostics Neg10.java
*/
class Neg10 {
interface I<X extends Exception> {
default void m() throws X { }
}
static class C1 {
public void m() throws Exception { } //unchecked (throws) override
}
static class C2<Z extends Exception> extends C1 implements I<Z> { }
static class C3<Z extends Exception> implements I<Z> {
public void m() throws Exception { } //unchecked (throws) override
}
}