aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell/*
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell *
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * This code is free software; you can redistribute it and/or modify it
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * under the terms of the GNU General Public License version 2 only, as
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * published by the Free Software Foundation.
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell *
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * This code is distributed in the hope that it will be useful, but WITHOUT
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * version 2 for more details (a copy is included in the LICENSE file that
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * accompanied this code).
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell *
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * You should have received a copy of the GNU General Public License version
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * 2 along with this work; if not, write to the Free Software Foundation,
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts *
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8df830cfcb62dc89bde4fa289fae5688d0634798Craig McDonnell * or visit www.oracle.com if you need additional information or have any
d84817c20fc73c3fd7832b2c30555c1ccff0d04dJaco Jooste * questions.
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts */
8df830cfcb62dc89bde4fa289fae5688d0634798Craig McDonnell
8df830cfcb62dc89bde4fa289fae5688d0634798Craig McDonnell/*
8df830cfcb62dc89bde4fa289fae5688d0634798Craig McDonnell * @test
8df830cfcb62dc89bde4fa289fae5688d0634798Craig McDonnell * @bug 5041230
bab1e6524fca64a55ecfc2503295092db8e0f48eCraig McDonnell * @summary Cannot cast Comparable<?>s
8df830cfcb62dc89bde4fa289fae5688d0634798Craig McDonnell * @author gafter
8df830cfcb62dc89bde4fa289fae5688d0634798Craig McDonnell *
8df830cfcb62dc89bde4fa289fae5688d0634798Craig McDonnell * @compile -Werror -Xlint:unchecked Casting4.java
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts */
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpottspackage Casting4;
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpottsclass Casting4 {
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts <M> Integer f(Comparable<M> c) {
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts return (Integer) c;
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts }
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts Integer g(Comparable<?> c) {
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts return (Integer) c;
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts }
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts}
bf36b5c30cb4d181af39c91096b86fdf628ca189James Phillpotts