test/tools/javac/defaultMethods/Neg03.java

Wed, 07 Nov 2012 17:20:12 -0800

author
jjg
date
Wed, 07 Nov 2012 17:20:12 -0800
changeset 1402
a1dc543483fc
parent 1393
d7d932236fee
child 1415
01c9d4161882
permissions
-rw-r--r--

8003134: CheckResourceKeys issues
Reviewed-by: jjh, bpatel

mcimadamore@1393 1 /*
mcimadamore@1393 2 * @test /nodynamiccopyright/
mcimadamore@1393 3 * @summary check that re-abstraction works properly
mcimadamore@1393 4 * @compile/fail/ref=Neg03.out -XDallowDefaultMethods -XDrawDiagnostics Neg03.java
mcimadamore@1393 5 */
mcimadamore@1393 6
mcimadamore@1393 7 class Neg03 {
mcimadamore@1393 8 interface A {
mcimadamore@1393 9 default void m() { Neg03.one(this); }
mcimadamore@1393 10 }
mcimadamore@1393 11
mcimadamore@1393 12 interface B {
mcimadamore@1393 13 default void m() { Neg03.two(this); }
mcimadamore@1393 14 }
mcimadamore@1393 15
mcimadamore@1393 16 interface C extends A, B {
mcimadamore@1393 17 default void m() { Neg03.one(this); }
mcimadamore@1393 18 }
mcimadamore@1393 19
mcimadamore@1393 20 static class X implements C, A { } //ok - ignore extraneous remix of A
mcimadamore@1393 21
mcimadamore@1393 22 interface D extends A, B {
mcimadamore@1393 23 void m(); // ok - m() is not reabstracted!
mcimadamore@1393 24 }
mcimadamore@1393 25
mcimadamore@1393 26 static class Y implements D, A { } // invalid - abstract D.m()
mcimadamore@1393 27
mcimadamore@1393 28 interface E extends A {
mcimadamore@1393 29 void m(); // reabstraction of m()
mcimadamore@1393 30 }
mcimadamore@1393 31
mcimadamore@1393 32 static class W implements D, E { } // invalid - abstracts D.m()/E.m()
mcimadamore@1393 33
mcimadamore@1393 34 static class Z implements D, A, B { } // invalid - abstract D.m()
mcimadamore@1393 35
mcimadamore@1393 36 static void one(Object a) { }
mcimadamore@1393 37 static void two(Object a) { }
mcimadamore@1393 38 }

mercurial