langtools/test/tools/javac/generics/rawOverride/T6846972.java
author mcimadamore
Wed, 15 Jul 2009 10:25:01 +0100
changeset 3372 544ec1ab333c
child 5520 86e4b9a9da40
permissions -rw-r--r--
6846972: cannot access member of raw type when erasure change overriding into overloading Summary: fix of 6400189 caused a nasty problem in method resolution Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3372
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
     1
/*
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
     4
 *
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
     8
 *
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    14
 *
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    18
 *
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    21
 * have any questions.
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    22
 */
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    23
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    24
/*
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    25
 * @test
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    26
 * @bug 6846972
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    27
 * @summary cannot access member of raw type when erasure change overriding into overloading
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    28
 * @author mcimadamore
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    29
 * @compile T6846972.java
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    30
 */
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    31
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    32
import java.util.EnumMap;
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    33
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    34
public class T6846972 {
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    35
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    36
    enum Suit {
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    37
        CLUBS, DIAMONDS;
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    38
    }
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    39
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    40
    static Object [] array = {
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    41
        Suit.CLUBS, "value1",
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    42
        Suit.DIAMONDS, "value2"
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    43
    };
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    44
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    45
    static void test() {
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    46
        EnumMap map = new EnumMap(Suit.class);
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    47
        map.put(array[0], array[1]);
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    48
    }
544ec1ab333c 6846972: cannot access member of raw type when erasure change overriding into overloading
mcimadamore
parents:
diff changeset
    49
}