test/tools/javac/defaultMethods/Neg03.java

Mon, 01 Jun 2015 15:19:54 -0700

author
darcy
date
Mon, 01 Jun 2015 15:19:54 -0700
changeset 3834
45746e46893b
parent 2020
bb7271e64ef6
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8075546: Add tiered testing definitions to the langtools repo
Reviewed-by: jjg

jfranck@2020 1 /* @test /nodynamiccopyright/
jfranck@2020 2 * @bug 7192246
mcimadamore@1393 3 * @summary check that re-abstraction works properly
mcimadamore@1415 4 * @compile/fail/ref=Neg03.out -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