jlahoda@2563: /* jlahoda@2563: * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. jlahoda@2563: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jlahoda@2563: * jlahoda@2563: * This code is free software; you can redistribute it and/or modify it jlahoda@2563: * under the terms of the GNU General Public License version 2 only, as jlahoda@2563: * published by the Free Software Foundation. jlahoda@2563: * jlahoda@2563: * This code is distributed in the hope that it will be useful, but WITHOUT jlahoda@2563: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jlahoda@2563: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jlahoda@2563: * version 2 for more details (a copy is included in the LICENSE file that jlahoda@2563: * accompanied this code). jlahoda@2563: * jlahoda@2563: * You should have received a copy of the GNU General Public License version jlahoda@2563: * 2 along with this work; if not, write to the Free Software Foundation, jlahoda@2563: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jlahoda@2563: * jlahoda@2563: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jlahoda@2563: * or visit www.oracle.com if you need additional information or have any jlahoda@2563: * questions. jlahoda@2563: */ jlahoda@2563: jlahoda@2563: /** jlahoda@2563: * @test jlahoda@2563: * @bug 8056014 jlahoda@2563: * @summary Verify that full type inference is used when calling a method on a type variable. jlahoda@2563: * @compile T8056014.java jlahoda@2563: * @run main T8056014 jlahoda@2563: */ jlahoda@2563: jlahoda@2563: import java.util.*; jlahoda@2563: jlahoda@2563: public class T8056014 { jlahoda@2563: public static void main(String[] args) { jlahoda@2563: new T8056014().run(); jlahoda@2563: } jlahoda@2563: jlahoda@2563: void run() { jlahoda@2563: List l = Arrays.asList(new S()); jlahoda@2563: C c = new C<>(new S()); jlahoda@2563: foo(l.get(0).copy(1)); jlahoda@2563: foo(c.get(0).copy(1)); jlahoda@2563: } jlahoda@2563: jlahoda@2563: void foo(S d) { jlahoda@2563: } jlahoda@2563: } jlahoda@2563: jlahoda@2563: class B { jlahoda@2563: public B copy(long j) { jlahoda@2563: throw new AssertionError("Should not get here."); jlahoda@2563: } jlahoda@2563: } jlahoda@2563: jlahoda@2563: class S extends B { jlahoda@2563: public T copy(int i) { jlahoda@2563: return null; jlahoda@2563: } jlahoda@2563: } jlahoda@2563: jlahoda@2563: class C { jlahoda@2563: final T t; jlahoda@2563: public C(T t) { jlahoda@2563: this.t = t; jlahoda@2563: } jlahoda@2563: public T get(int i) { jlahoda@2563: return t; jlahoda@2563: } jlahoda@2563: }