langtools/test/tools/javac/generics/6729401/T6729401.java
author mcimadamore
Thu, 29 Jan 2009 12:19:14 +0000
changeset 1993 9b37ef07ba64
child 2212 1d3dc0e0ba0c
permissions -rw-r--r--
6729401: Compiler error when using F-bounded generics with free type variables Summary: Javac applies wrong substitution to recursive type-variable bounds Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1993
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
     1
/*
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
     2
 * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
     4
 *
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
     8
 *
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    14
 *
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    18
 *
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    21
 * have any questions.
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    22
 */
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    23
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    24
/*
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    25
 * @test
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    26
 * @bug 6729401
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    27
 *
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    28
 * @summary  Compiler error when using F-bounded generics with free type variables
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    29
 * @author Maurizio Cimadamore
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    30
 * @compile T6729401.java
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    31
 *
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    32
 */
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    33
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    34
class T6729401 {
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    35
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    36
    interface I<U,W> {
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    37
        <T extends I<U,T>> void m(I<U,T> x);
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    38
    }
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    39
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    40
    <X extends I<Object,X>,Y extends I<Object,Y>> void test(I<Object,X> x, I<Object,Y> y) {
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    41
        x.<Y>m(y);
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    42
        x.m(y);
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    43
        y.<X>m(x);
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    44
        y.m(x);
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    45
    }
9b37ef07ba64 6729401: Compiler error when using F-bounded generics with free type variables
mcimadamore
parents:
diff changeset
    46
}