Tue, 16 Jun 2009 10:46:37 +0100
6638712: Inference with wildcard types causes selection of inapplicable method
Summary: Added global sanity check in order to make sure that return type inference does not violate bounds constraints
Reviewed-by: jjg
mcimadamore@299 | 1 | /* |
mcimadamore@299 | 2 | * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. |
mcimadamore@299 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
mcimadamore@299 | 4 | * |
mcimadamore@299 | 5 | * This code is free software; you can redistribute it and/or modify it |
mcimadamore@299 | 6 | * under the terms of the GNU General Public License version 2 only, as |
mcimadamore@299 | 7 | * published by the Free Software Foundation. |
mcimadamore@299 | 8 | * |
mcimadamore@299 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
mcimadamore@299 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
mcimadamore@299 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
mcimadamore@299 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
mcimadamore@299 | 13 | * accompanied this code). |
mcimadamore@299 | 14 | * |
mcimadamore@299 | 15 | * You should have received a copy of the GNU General Public License version |
mcimadamore@299 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
mcimadamore@299 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
mcimadamore@299 | 18 | * |
mcimadamore@299 | 19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
mcimadamore@299 | 20 | * CA 95054 USA or visit www.sun.com if you need additional information or |
mcimadamore@299 | 21 | * have any questions. |
mcimadamore@299 | 22 | */ |
mcimadamore@299 | 23 | |
mcimadamore@299 | 24 | /* |
mcimadamore@299 | 25 | * @test |
mcimadamore@299 | 26 | * @bug 6638712 |
mcimadamore@299 | 27 | * @author mcimadamore |
mcimadamore@299 | 28 | * @summary Inference with wildcard types causes selection of inapplicable method |
mcimadamore@299 | 29 | * @compile/fail/ref=T6638712b.out -XDrawDiagnostics T6638712b.java |
mcimadamore@299 | 30 | */ |
mcimadamore@299 | 31 | |
mcimadamore@299 | 32 | class T6638712b<X> { |
mcimadamore@299 | 33 | |
mcimadamore@299 | 34 | <I extends T6638712b<T>, T> T m(I test) { return null; } |
mcimadamore@299 | 35 | |
mcimadamore@299 | 36 | void test(T6638712b<Integer> x) { |
mcimadamore@299 | 37 | String i = m(x); |
mcimadamore@299 | 38 | } |
mcimadamore@299 | 39 | } |