NonSAM2.java revision 4184:3b9297698293
1/*
2 * @test /nodynamiccopyright/
3 * @bug 8003280 7170058
4 * @summary Add lambda tests
5 *   This test is for identifying a non-SAM type: Having more than one methods due to inheritance, and none of them has a subsignature of all other methods
6 * @compile/fail/ref=NonSAM2.out -XDrawDiagnostics NonSAM2.java Helper.java
7 */
8
9import java.util.List;
10
11interface Foo1 { int getAge(String s);}
12interface Bar1 { Integer getAge(String s);}
13interface Foo1Bar1 extends Foo1, Bar1 {} //types Bar1 and Foo1 are incompatible; both define getAge(String), but with unrelated return types
14
15interface AC extends A, C {} //name clash: getOldest(List<?>) in C and getOldest(List<Number>) in A have the same erasure, yet neither overrides the other
16interface ABC extends A, B, C {} //ok - raw override
17interface AD extends A, D {} //name clash: getOldest(List<Integer>) in D and getOldest(List<Number>) in A have the same erasure, yet neither overrides the other
18
19interface Foo2<T> { void m(T arg);}
20interface Bar2<S> { void m(S arg);}
21interface Foo2Bar2<T1, T2> extends Foo2<T1>, Bar2<T2> {} //name clash: m(S) in Bar and m(T) in Foo have the same erasure, yet neither overrides the other
22