langtools/test/tools/javac/generics/inference/6369605/T6369605b.java
author mcimadamore
Mon, 16 Aug 2010 14:58:10 +0100
changeset 6348 6c9b14d4a438
permissions -rw-r--r--
6369605: Unconstrained type variables fails to include bounds Summary: unconstrained type-variables with recursive bounds are not inferred properly Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6348
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
     1
/*
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
     4
 *
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
     8
 *
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    14
 *
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    18
 *
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    21
 * questions.
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    22
 */
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    23
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    24
/**
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    25
 * @test
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    26
 * @bug 6369605
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    27
 * @summary Unconstrained type variables fails to include bounds
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    28
 * @author mcimadamore
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    29
 * @compile T6369605b.java
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    30
 */
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    31
import java.util.List;
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    32
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    33
class T6369605b {
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    34
    static <T extends List<X>, X> List<T> m1() {
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    35
        return null;
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    36
    }
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    37
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    38
    static <T extends List<U>, U extends List<X>, X> List<T> m2() {
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    39
        return null;
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    40
    }
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    41
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    42
    static <T extends List<U>, U extends List<V>, V extends List<X>, X> List<T> m3() {
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    43
        return null;
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    44
    }
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    45
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    46
    List<?> l1 = m1();
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    47
    List<?> l2 = m2();
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    48
    List<?> l3 = m3();
6c9b14d4a438 6369605: Unconstrained type variables fails to include bounds
mcimadamore
parents:
diff changeset
    49
}