mcimadamore@742: /* ohair@962: * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. mcimadamore@742: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. mcimadamore@742: * mcimadamore@742: * This code is free software; you can redistribute it and/or modify it mcimadamore@742: * under the terms of the GNU General Public License version 2 only, as mcimadamore@742: * published by the Free Software Foundation. mcimadamore@742: * mcimadamore@742: * This code is distributed in the hope that it will be useful, but WITHOUT mcimadamore@742: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or mcimadamore@742: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mcimadamore@742: * version 2 for more details (a copy is included in the LICENSE file that mcimadamore@742: * accompanied this code). mcimadamore@742: * mcimadamore@742: * You should have received a copy of the GNU General Public License version mcimadamore@742: * 2 along with this work; if not, write to the Free Software Foundation, mcimadamore@742: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. mcimadamore@742: * mcimadamore@742: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA mcimadamore@742: * or visit www.oracle.com if you need additional information or have any mcimadamore@742: * questions. mcimadamore@742: */ mcimadamore@742: mcimadamore@742: /* mcimadamore@742: * @test mcimadamore@810: * @bug 6999067 7010194 mcimadamore@742: * @summary cast for invokeExact call gets redundant cast to warnings mcimadamore@742: * @author mcimadamore mcimadamore@742: * mcimadamore@742: * @compile -Werror -Xlint:cast XlintWarn.java mcimadamore@742: */ mcimadamore@742: mcimadamore@742: import java.dyn.*; mcimadamore@742: mcimadamore@742: class XlintWarn { mcimadamore@742: void test(MethodHandle mh) throws Throwable { mcimadamore@810: int i1 = (int)mh.invokeExact(); mcimadamore@820: int i2 = (int)mh.invokeGeneric(); mcimadamore@820: int i3 = (int)mh.invokeWithArguments(); mcimadamore@820: } mcimadamore@820: mcimadamore@820: void test2(MethodHandle mh) throws Throwable { mcimadamore@820: int i1 = (int)(mh.invokeExact()); mcimadamore@820: int i2 = (int)(mh.invokeGeneric()); mcimadamore@820: int i3 = (int)(mh.invokeWithArguments()); mcimadamore@820: } mcimadamore@820: mcimadamore@820: void test3(MethodHandle mh) throws Throwable { mcimadamore@820: int i1 = (int)((mh.invokeExact())); mcimadamore@820: int i2 = (int)((mh.invokeGeneric())); mcimadamore@820: int i3 = (int)((mh.invokeWithArguments())); mcimadamore@742: } mcimadamore@742: }