Thu, 03 Feb 2011 09:36:28 +0000
5017953: spurious cascaded diagnostics when name not found
Summary: when an operator is applied to one or more erroneous operands, spurious diagnostics are generated
Reviewed-by: jjg
mcimadamore@742 | 1 | /* |
mcimadamore@742 | 2 | * Copyright (c) 2008, 2010, 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 | } |