test/tools/javac/meth/XlintWarn.java

Wed, 06 Apr 2011 20:33:44 -0700

author
ohair
date
Wed, 06 Apr 2011 20:33:44 -0700
changeset 962
0ff2bbd38f10
parent 820
2d5aff89aaa3
child 966
53f212bed4f4
permissions
-rw-r--r--

7033660: Update copyright year to 2011 on any files changed in 2011
Reviewed-by: dholmes

mcimadamore@742 1 /*
ohair@962 2 * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
mcimadamore@742 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@742 4 *
mcimadamore@742 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@742 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@742 7 * published by the Free Software Foundation.
mcimadamore@742 8 *
mcimadamore@742 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@742 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@742 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@742 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@742 13 * accompanied this code).
mcimadamore@742 14 *
mcimadamore@742 15 * You should have received a copy of the GNU General Public License version
mcimadamore@742 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@742 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@742 18 *
mcimadamore@742 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
mcimadamore@742 20 * or visit www.oracle.com if you need additional information or have any
mcimadamore@742 21 * questions.
mcimadamore@742 22 */
mcimadamore@742 23
mcimadamore@742 24 /*
mcimadamore@742 25 * @test
mcimadamore@810 26 * @bug 6999067 7010194
mcimadamore@742 27 * @summary cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore@742 28 * @author mcimadamore
mcimadamore@742 29 *
mcimadamore@742 30 * @compile -Werror -Xlint:cast XlintWarn.java
mcimadamore@742 31 */
mcimadamore@742 32
mcimadamore@742 33 import java.dyn.*;
mcimadamore@742 34
mcimadamore@742 35 class XlintWarn {
mcimadamore@742 36 void test(MethodHandle mh) throws Throwable {
mcimadamore@810 37 int i1 = (int)mh.invokeExact();
mcimadamore@820 38 int i2 = (int)mh.invokeGeneric();
mcimadamore@820 39 int i3 = (int)mh.invokeWithArguments();
mcimadamore@820 40 }
mcimadamore@820 41
mcimadamore@820 42 void test2(MethodHandle mh) throws Throwable {
mcimadamore@820 43 int i1 = (int)(mh.invokeExact());
mcimadamore@820 44 int i2 = (int)(mh.invokeGeneric());
mcimadamore@820 45 int i3 = (int)(mh.invokeWithArguments());
mcimadamore@820 46 }
mcimadamore@820 47
mcimadamore@820 48 void test3(MethodHandle mh) throws Throwable {
mcimadamore@820 49 int i1 = (int)((mh.invokeExact()));
mcimadamore@820 50 int i2 = (int)((mh.invokeGeneric()));
mcimadamore@820 51 int i3 = (int)((mh.invokeWithArguments()));
mcimadamore@742 52 }
mcimadamore@742 53 }

mercurial