Mon, 13 Dec 2010 14:56:50 +0000
7006109: Add test library to simplify the task of writing automated type-system tests
Summary: Types.java needs to be more stress-tested
Reviewed-by: jjg
mcimadamore@156 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. |
mcimadamore@156 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
mcimadamore@156 | 4 | * |
mcimadamore@156 | 5 | * This code is free software; you can redistribute it and/or modify it |
mcimadamore@156 | 6 | * under the terms of the GNU General Public License version 2 only, as |
mcimadamore@156 | 7 | * published by the Free Software Foundation. |
mcimadamore@156 | 8 | * |
mcimadamore@156 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
mcimadamore@156 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
mcimadamore@156 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
mcimadamore@156 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
mcimadamore@156 | 13 | * accompanied this code). |
mcimadamore@156 | 14 | * |
mcimadamore@156 | 15 | * You should have received a copy of the GNU General Public License version |
mcimadamore@156 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
mcimadamore@156 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
mcimadamore@156 | 18 | * |
ohair@554 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 20 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 21 | * questions. |
mcimadamore@156 | 22 | */ |
mcimadamore@156 | 23 | |
mcimadamore@156 | 24 | /* |
mcimadamore@156 | 25 | * @test |
mcimadamore@156 | 26 | * @bug 6487370 |
mcimadamore@156 | 27 | * @author Maurizio Cimadamore |
mcimadamore@156 | 28 | * @summary javac incorrectly gives ambiguity warning with override-equivalent abstract inherited methods |
mcimadamore@156 | 29 | */ |
mcimadamore@156 | 30 | |
mcimadamore@156 | 31 | public class T6487370 { |
mcimadamore@156 | 32 | |
mcimadamore@156 | 33 | interface I1 { |
mcimadamore@156 | 34 | String m(Number n); |
mcimadamore@156 | 35 | } |
mcimadamore@156 | 36 | |
mcimadamore@156 | 37 | interface I2 { |
mcimadamore@156 | 38 | Object m(Number n); |
mcimadamore@156 | 39 | } |
mcimadamore@156 | 40 | |
mcimadamore@156 | 41 | static abstract class X implements I1, I2 { |
mcimadamore@156 | 42 | String test() { |
mcimadamore@156 | 43 | return m(0.0f); |
mcimadamore@156 | 44 | } |
mcimadamore@156 | 45 | } |
mcimadamore@156 | 46 | |
mcimadamore@156 | 47 | static class W extends X { |
mcimadamore@156 | 48 | public String m(Number n) { |
mcimadamore@156 | 49 | return "Hello!"; |
mcimadamore@156 | 50 | } |
mcimadamore@156 | 51 | } |
mcimadamore@156 | 52 | |
mcimadamore@156 | 53 | public static void main(String args[]) { |
mcimadamore@156 | 54 | System.out.println(new W().test()); |
mcimadamore@156 | 55 | } |
mcimadamore@156 | 56 | } |