|
Java example source code file (Neg03.java)
The Neg03.java Java example source code
/* @test /nodynamiccopyright/
* @bug 7192246
* @summary check that re-abstraction works properly
* @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java
*/
class Neg03 {
interface A {
default void m() { Neg03.one(this); }
}
interface B {
default void m() { Neg03.two(this); }
}
interface C extends A, B {
default void m() { Neg03.one(this); }
}
static class X implements C, A { } //ok - ignore extraneous remix of A
interface D extends A, B {
void m(); // ok - m() is not reabstracted!
}
static class Y implements D, A { } // invalid - abstract D.m()
interface E extends A {
void m(); // reabstraction of m()
}
static class W implements D, E { } // invalid - abstracts D.m()/E.m()
static class Z implements D, A, B { } // invalid - abstract D.m()
static void one(Object a) { }
static void two(Object a) { }
}
Other Java examples (source code examples)Here is a short list of links related to this Java Neg03.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.