test/tools/javac/generics/diamond/neg/Neg04.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 diamond fails when inference violates declared bounds
mcimadamore@914 6 * (test with local class, qualified/simple type expressions)
mcimadamore@537 7 * @author mcimadamore
mcimadamore@537 8 * @compile/fail/ref=Neg04.out Neg04.java -XDrawDiagnostics
mcimadamore@537 9 *
mcimadamore@537 10 */
mcimadamore@537 11
mcimadamore@537 12 class Neg04 {
mcimadamore@537 13
mcimadamore@537 14 void test() {
mcimadamore@537 15 class Foo<V extends Number> {
mcimadamore@537 16 Foo(V x) {}
mcimadamore@537 17 <Z> Foo(V x, Z z) {}
mcimadamore@537 18 }
mcimadamore@537 19 Foo<String> n1 = new Foo<>("");
mcimadamore@537 20 Foo<? extends String> n2 = new Foo<>("");
mcimadamore@537 21 Foo<?> n3 = new Foo<>("");
mcimadamore@537 22 Foo<? super String> n4 = new Foo<>("");
mcimadamore@537 23
mcimadamore@914 24 Foo<String> n5 = new Foo<>("", "");
mcimadamore@914 25 Foo<? extends String> n6 = new Foo<>("", "");
mcimadamore@914 26 Foo<?> n7 = new Foo<>("", "");
mcimadamore@914 27 Foo<? super String> n8 = new Foo<>("", "");
mcimadamore@537 28 }
mcimadamore@537 29 }

mercurial