|
Java example source code file (Test3.java)
The Test3.java Java example source code
/**
* @test /nodynamiccopyright/
* @bug 7062745 7157798
* @summary Negative test of conflicting same-name methods inherited from multiple interfaces when return type not compatible
* @compile/fail/ref=Test3.out -Werror -Xlint:unchecked -XDrawDiagnostics Test3.java
*/
import java.util.List;
import java.io.Serializable;
interface A { int m(); }
interface B { Integer m(); }
interface AB extends A, B {} //error
interface C { List<Integer> m(); }
interface D { List<Number> m(); }
interface CD extends C, D {} //error
interface E<T> { T m(); }
interface F<T> { T m(); }
interface G { Serializable m(); }
interface BE extends B, E<Number> {} //ok, covariant return
interface BE2<T> extends B, E
Other Java examples (source code examples)Here is a short list of links related to this Java Test3.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.