langtools/test/tools/javac/generics/inference/8159680/T8159680.java
author mcimadamore
Fri, 17 Jun 2016 18:17:16 +0100
changeset 39100 5dc24593e3ae
permissions -rw-r--r--
8159680: Inference failure with unchecked subtyping and arrays Summary: Discrepancy in handling of capture conversion between Types.isSubtype and Types.isSubtypeUnchecked Reviewed-by: vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39100
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
     1
/*
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
     4
 *
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    10
 *
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    15
 * accompanied this code).
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    16
 *
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    20
 *
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    23
 * questions.
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    24
 */
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    25
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    26
/*
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    27
 * @test
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    28
 * @bug 8159680
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    29
 * @summary Inference failure with unchecked subtyping and arrays
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    30
 * @compile T8159680.java
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    31
 */
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    32
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    33
class T8159680 {
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    34
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    35
    static class Condition<T> {}
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    36
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    37
    @SafeVarargs
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    38
    static <T> Condition<T> allOf(Condition<? super T>... conditions) {
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    39
        return null;
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    40
    }
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    41
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    42
    @SafeVarargs
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    43
    static void test(Condition<? super Number>... conditions) {
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    44
        allOf(conditions);
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    45
    }
5dc24593e3ae 8159680: Inference failure with unchecked subtyping and arrays
mcimadamore
parents:
diff changeset
    46
}