test/tools/javac/lambda/funcInterfaces/NonSAM2.java

Wed, 14 May 2014 15:41:28 -0600

author
dlsmith
date
Wed, 14 May 2014 15:41:28 -0600
changeset 2395
9c577131ffa6
parent 1811
349160289ba2
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8034223: Most-specific should not have any special treatment for boxed vs. unboxed types
Summary: Rewrite most-specific logic to conform to JLS 8 15.12.2.5
Reviewed-by: vromero

mcimadamore@1415 1 /*
mcimadamore@1415 2 * @test /nodynamiccopyright/
mcimadamore@1415 3 * @bug 8003280
mcimadamore@1415 4 * @summary Add lambda tests
mcimadamore@1415 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
mcimadamore@1415 6 * @compile/fail/ref=NonSAM2.out -XDrawDiagnostics NonSAM2.java Helper.java
mcimadamore@1415 7 */
mcimadamore@1415 8
mcimadamore@1415 9 import java.util.List;
mcimadamore@1415 10
mcimadamore@1415 11 interface Foo1 { int getAge(String s);}
mcimadamore@1415 12 interface Bar1 { Integer getAge(String s);}
mcimadamore@1415 13 interface Foo1Bar1 extends Foo1, Bar1 {} //types Bar1 and Foo1 are incompatible; both define getAge(String), but with unrelated return types
mcimadamore@1415 14
mcimadamore@1415 15 interface 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
mcimadamore@1811 16 interface ABC extends A, B, C {} //ok - raw override
mcimadamore@1415 17 interface 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
mcimadamore@1415 18
mcimadamore@1415 19 interface Foo2<T> { void m(T arg);}
mcimadamore@1415 20 interface Bar2<S> { void m(S arg);}
mcimadamore@1415 21 interface 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

mercurial