test/tools/javac/generics/diamond/7030150/Neg03.java

Tue, 29 Mar 2011 16:40:51 +0100

author
mcimadamore
date
Tue, 29 Mar 2011 16:40:51 +0100
changeset 950
f5b5112ee1cc
permissions
-rw-r--r--

7030150: Type inference for generic instance creation failed for formal type parameter
Summary: Problem when explicit generic constructor type-arguments are used in conjunction with diamond
Reviewed-by: jjg

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 7030150
     4  * @summary Type inference for generic instance creation failed for formal type parameter
     5  *          check that explicit type-argument that does not conform to bound is rejected
     6  * @compile/fail/ref=Neg03.out -XDrawDiagnostics Neg03.java
     7  */
     9 class Neg03 {
    11     static class Foo<X> {
    12         <T extends Integer> Foo(T t) {}
    13     }
    15     Foo<Integer> fi1 = new <String> Foo<>(1);
    16     Foo<Integer> fi2 = new <String> Foo<Integer>(1);
    17 }

mercurial