test/tools/javac/generics/6487370/T6487370.java

Tue, 11 Aug 2009 01:13:42 +0100

author
mcimadamore
date
Tue, 11 Aug 2009 01:13:42 +0100
changeset 360
62fb6cafa93b
parent 156
db77bf6adb53
child 554
9d9f26857129
permissions
-rw-r--r--

6869075: regression: javac crashes when compiling compound string assignment with generics
Summary: javac should not add syntehtic cast to the LHS of an assignment expression
Reviewed-by: jjg

mcimadamore@156 1 /*
mcimadamore@156 2 * Copyright 2008 Sun Microsystems, Inc. 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 *
mcimadamore@156 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
mcimadamore@156 20 * CA 95054 USA or visit www.sun.com if you need additional information or
mcimadamore@156 21 * have any 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 }

mercurial