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

Mon, 26 Mar 2012 15:28:22 +0100

author
mcimadamore
date
Mon, 26 Mar 2012 15:28:22 +0100
changeset 1238
e28a06a3c5d9
parent 914
ca32f2986301
child 2525
2eb010b6cb22
permissions
-rw-r--r--

7151492: Encapsulate check logic into Attr.ResultInfo
Summary: ResultInfo class should be used to make attribution code transparent w.r.t. check logic being used
Reviewed-by: jjg, dlsmith

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 6939620 7020044
     4  *
     5  * @summary  Check that diamond fails when inference violates declared bounds
     6  *           (test with local class, qualified/simple type expressions)
     7  * @author mcimadamore
     8  * @compile/fail/ref=Neg04.out Neg04.java -XDrawDiagnostics
     9  *
    10  */
    12 class Neg04 {
    14     void test() {
    15         class Foo<V extends Number> {
    16             Foo(V x) {}
    17             <Z> Foo(V x, Z z) {}
    18         }
    19         Foo<String> n1 = new Foo<>("");
    20         Foo<? extends String> n2 = new Foo<>("");
    21         Foo<?> n3 = new Foo<>("");
    22         Foo<? super String> n4 = new Foo<>("");
    24         Foo<String> n5 = new Foo<>("", "");
    25         Foo<? extends String> n6 = new Foo<>("", "");
    26         Foo<?> n7 = new Foo<>("", "");
    27         Foo<? super String> n8 = new Foo<>("", "");
    28     }
    29 }

mercurial