langtools/test/tools/javac/generics/inference/6938454/T6938454a.java
author ohair
Thu, 09 Sep 2010 16:29:40 -0700
changeset 6387 035df75cc1a9
parent 6154 c1b0c6641b92
permissions -rw-r--r--
6982137: Rebranding pass 2 - missed copyright changes Reviewed-by: mbykov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6154
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
     1
/*
6387
035df75cc1a9 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 6154
diff changeset
     2
 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
6154
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
     4
 *
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
     8
 *
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    14
 *
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    18
 *
6387
035df75cc1a9 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 6154
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
035df75cc1a9 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 6154
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
035df75cc1a9 6982137: Rebranding pass 2 - missed copyright changes
ohair
parents: 6154
diff changeset
    21
 * questions.
6154
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    22
 */
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    23
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    24
/*
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    25
 * @test
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    26
 * @bug 6938454
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    27
 *
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    28
 * @summary Unable to determine generic type in program that compiles under Java 6
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    29
 * @author mcimadamore
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    30
 * @compile T6938454a.java
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    31
 *
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    32
 */
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    33
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    34
class T6938454a {
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    35
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    36
    static abstract class A { }
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    37
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    38
    static class B extends A { }
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    39
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    40
    B getB(B b) {
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    41
        return makeA(b);
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    42
    }
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    43
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    44
    <X extends A, Y extends X> Y makeA(X x) {
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    45
        return (Y)new B();
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    46
    }
c1b0c6641b92 6938454: Unable to determine generic type in program that compiles under Java 6
mcimadamore
parents:
diff changeset
    47
}