langtools/test/tools/javac/generics/inference/7177306/T7177306d.java
author mcimadamore
Tue, 25 Sep 2012 11:56:46 +0100
changeset 14048 308d1cf8fe46
permissions -rw-r--r--
7177306: Regression: unchecked method call does not erase return type Summary: Spurious extra call to Attr.checkMethod when method call is unchecked Reviewed-by: jjg, dlsmith
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14048
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
     1
/*
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
     2
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
     4
 *
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
     8
 *
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    14
 *
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    18
 *
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    21
 * questions.
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    22
 */
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    23
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    24
/*
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    25
 * @test
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    26
 * @bug 7177306
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    27
 * @summary Regression: unchecked method call does not erase return type
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    28
 */
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    29
import java.util.List;
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    30
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    31
public class T7177306d {
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    32
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    33
    static int assertionCount = 0;
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    34
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    35
    static void assertTrue(boolean cond) {
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    36
        if (!cond) {
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    37
            throw new AssertionError();
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    38
        }
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    39
        assertionCount++;
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    40
    }
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    41
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    42
    static <T, S extends List<T>> void m(List<? super T> arg1, S arg2, Class<Object> arg3) { assertTrue(false); }
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    43
    static void m(Object o1, Object o2, Object o3) { assertTrue(true); }
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    44
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    45
    static void test(List<Integer> li, List<String> ls, Class c) {
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    46
        m(li, ls, c);
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    47
    }
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    48
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    49
    public static void main(String[] args) {
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    50
        test(null, null, null);
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    51
        assertTrue(assertionCount == 1);
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    52
    }
308d1cf8fe46 7177306: Regression: unchecked method call does not erase return type
mcimadamore
parents:
diff changeset
    53
}