langtools/test/tools/javac/generics/inference/6995200/T6995200.java
changeset 7331 02ffc087c654
equal deleted inserted replaced
7330:7c670eebe55c 7331:02ffc087c654
       
     1 /*
       
     2  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 /*
       
    25  * @test
       
    26  * @bug 6995200
       
    27  *
       
    28  * @summary JDK 7 compiler crashes when type-variable is inferred from expected primitive type
       
    29  * @author mcimadamore
       
    30  * @compile T6995200.java
       
    31  *
       
    32  */
       
    33 
       
    34 import java.util.List;
       
    35 
       
    36 class T6995200 {
       
    37     static <T> T getValue() {
       
    38         return null;
       
    39     }
       
    40 
       
    41     <X> void test() {
       
    42         byte v1 = getValue();
       
    43         short v2 = getValue();
       
    44         int v3 = getValue();
       
    45         long v4 = getValue();
       
    46         float v5 = getValue();
       
    47         double v6 = getValue();
       
    48         String v7 = getValue();
       
    49         String[] v8 = getValue();
       
    50         List<String> v9 = getValue();
       
    51         List<String>[] v10 = getValue();
       
    52         List<? extends String> v11 = getValue();
       
    53         List<? extends String>[] v12 = getValue();
       
    54         List<? super String> v13 = getValue();
       
    55         List<? super String>[] v14 = getValue();
       
    56         List<?> v15 = getValue();
       
    57         List<?>[] v16 = getValue();
       
    58         X v17 = getValue();
       
    59         X[] v18 = getValue();
       
    60         List<X> v19 = getValue();
       
    61         List<X>[] v20 = getValue();
       
    62         List<? extends X> v21 = getValue();
       
    63         List<? extends X>[] v22 = getValue();
       
    64         List<? super X> v23 = getValue();
       
    65         List<? super X>[] v24 = getValue();
       
    66     }
       
    67 }