T4684378.java revision 288
3863N/A/*
4168N/A * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
3863N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3863N/A *
3863N/A * This code is free software; you can redistribute it and/or modify it
3863N/A * under the terms of the GNU General Public License version 2 only, as
3863N/A * published by the Free Software Foundation.
3863N/A *
3863N/A * This code is distributed in the hope that it will be useful, but WITHOUT
3863N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3863N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3863N/A * version 2 for more details (a copy is included in the LICENSE file that
3863N/A * accompanied this code).
3863N/A *
3863N/A * You should have received a copy of the GNU General Public License version
3863N/A * 2 along with this work; if not, write to the Free Software Foundation,
3863N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3863N/A *
3863N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
3863N/A * CA 95054 USA or visit www.sun.com if you need additional information or
3863N/A * have any questions.
3863N/A */
3863N/A
3863N/A/*
3863N/A * @test
3863N/A * @bug 4684378
3863N/A * @summary generics: verify error in generated bytecode
3863N/A * @author gafter
3863N/A *
3863N/A * @compile T4684378.java
3863N/A * @run main T4684378
4168N/A */
4168N/A
4168N/Aimport java.util.Stack;
4168N/Apublic class T4684378 {
4168N/A public static void main(String[] argv) {
4168N/A Stack<String> bar = new Stack<String>();
4168N/A String foo;
4168N/A
4168N/A // Compiles, but causes verify error
4168N/A foo=(bar.empty()?"":bar.peek()).intern();
3863N/A
3863N/A // The following two work fine
3863N/A foo = (bar.empty()?"":bar.peek().intern());
3863N/A foo = (bar.empty()?"":(String)bar.peek()).intern();
3863N/A }
3863N/A}
3863N/A