test/tools/javac/generics/diamond/neg/Neg05.java

Mon, 21 Jan 2013 20:13:56 +0000

author
mcimadamore
date
Mon, 21 Jan 2013 20:13:56 +0000
changeset 1510
7873d37f5b37
parent 914
ca32f2986301
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8005244: Implement overload resolution as per latest spec EDR
Summary: Add support for stuck expressions and provisional applicability
Reviewed-by: jjg

mcimadamore@537 1 /*
mcimadamore@537 2 * @test /nodynamiccopyright/
mcimadamore@914 3 * @bug 6939620 7020044
mcimadamore@537 4 *
mcimadamore@914 5 * @summary Check that usage of rare types doesn't cause spurious diamond diagnostics
mcimadamore@537 6 * @author mcimadamore
mcimadamore@537 7 * @compile/fail/ref=Neg05.out Neg05.java -XDrawDiagnostics
mcimadamore@537 8 *
mcimadamore@537 9 */
mcimadamore@537 10
mcimadamore@537 11 class Neg05<U> {
mcimadamore@537 12
mcimadamore@537 13 class Foo<V> {
mcimadamore@537 14 Foo(V x) {}
mcimadamore@537 15 <Z> Foo(V x, Z z) {}
mcimadamore@537 16 }
mcimadamore@537 17
mcimadamore@537 18 void testRare_1() {
mcimadamore@537 19 Neg05<?>.Foo<String> f1 = new Neg05.Foo<>("");
mcimadamore@537 20 Neg05<?>.Foo<? extends String> f2 = new Neg05.Foo<>("");
mcimadamore@537 21 Neg05<?>.Foo<?> f3 = new Neg05.Foo<>("");
mcimadamore@537 22 Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<>("");
mcimadamore@537 23
mcimadamore@914 24 Neg05<?>.Foo<String> f5 = new Neg05.Foo<>("", "");
mcimadamore@914 25 Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<>("", "");
mcimadamore@914 26 Neg05<?>.Foo<?> f7 = new Neg05.Foo<>("", "");
mcimadamore@914 27 Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<>("", "");
mcimadamore@537 28 }
mcimadamore@537 29
mcimadamore@537 30 void testRare_2(Neg05 n) {
mcimadamore@537 31 Neg05<?>.Foo<String> f1 = n.new Foo<>("");
mcimadamore@537 32 Neg05<?>.Foo<? extends String> f2 = n.new Foo<>("");
mcimadamore@537 33 Neg05<?>.Foo<?> f3 = n.new Foo<>("");
mcimadamore@537 34 Neg05<?>.Foo<? super String> f4 = n.new Foo<>("");
mcimadamore@537 35
mcimadamore@914 36 Neg05<?>.Foo<String> f5 = n.new Foo<>("", "");
mcimadamore@914 37 Neg05<?>.Foo<? extends String> f6 = n.new Foo<>("", "");
mcimadamore@914 38 Neg05<?>.Foo<?> f7 = n.new Foo<>("", "");
mcimadamore@914 39 Neg05<?>.Foo<? super String> f8 = n.new Foo<>("", "");
mcimadamore@537 40 }
mcimadamore@537 41 }

mercurial