test/tools/javac/varargs/6806876/T6806876.java

Tue, 11 Aug 2009 01:11:37 +0100

author
mcimadamore
date
Tue, 11 Aug 2009 01:11:37 +0100
changeset 356
d5f6c475f475
child 384
ed31953ca025
permissions
-rw-r--r--

6806876: ClassCastException occurs in assignment expressions without any heap pollutions
Summary: intersection types should be considered as non-reifiable by javac
Reviewed-by: jjg

mcimadamore@356 1 /*
mcimadamore@356 2 * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
mcimadamore@356 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@356 4 *
mcimadamore@356 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@356 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@356 7 * published by the Free Software Foundation.
mcimadamore@356 8 *
mcimadamore@356 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@356 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@356 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@356 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@356 13 * accompanied this code).
mcimadamore@356 14 *
mcimadamore@356 15 * You should have received a copy of the GNU General Public License version
mcimadamore@356 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@356 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@356 18 *
mcimadamore@356 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
mcimadamore@356 20 * CA 95054 USA or visit www.sun.com if you need additional information or
mcimadamore@356 21 * have any questions.
mcimadamore@356 22 */
mcimadamore@356 23
mcimadamore@356 24 /*
mcimadamore@356 25 * @test
mcimadamore@356 26 * @bug 6806876
mcimadamore@356 27 * @author mcimadamore
mcimadamore@356 28 * @summary ClassCastException occurs in assignment expressions without any heap pollutions
mcimadamore@356 29 * @compile/fail/ref=T6806876.out -Xlint:unchecked -Werror -XDrawDiagnostics T6806876.java
mcimadamore@356 30 */
mcimadamore@356 31
mcimadamore@356 32 class T6806876 {
mcimadamore@356 33 void test(Integer i, Long l) {
mcimadamore@356 34 Comparable<?>[] res = m(i, l);
mcimadamore@356 35 }
mcimadamore@356 36
mcimadamore@356 37 <T> T[] m(T...a) {
mcimadamore@356 38 return null;
mcimadamore@356 39 }
mcimadamore@356 40 }

mercurial