Mon, 21 May 2012 16:10:14 -0700
7157798: Add 6 test scenarios for testing inheritance of multiple same-name methods from mulitple interfaces
Reviewed-by: mcimadamore
Contributed-by: sue.wei@oracle.com
1 /**
2 * @test /nodynamiccopyright/
3 * @bug 7062745 7157798
4 * @summary Negative test of conflicting same-name methods inherited from multiple interfaces when parameter types not compatible
5 * @compile/fail/ref=Test4.out -Werror -Xlint:unchecked -XDrawDiagnostics Test4.java
6 */
8 import java.util.Set;
9 import java.util.HashSet;
11 interface A { void m(Set<Integer> s); }
12 interface B { void m(Set<String> s); }
13 interface C { void m(Set<?> s); }
15 interface AB extends A, B {} //error
17 interface AC extends A, C {} //error
19 interface D<T> { void m(Set<T> s); }
21 interface AD extends A, D<Integer> {} //OK
23 interface AD2 extends A, D<Number> {} //error
25 interface CD<T> extends C, D<T> {} //error
27 interface E { <T> void m(Set<T> s); }
29 interface DE<T> extends D<T>, E {} //error