langtools/test/tools/javac/meth/XlintWarn.java
author hannesw
Tue, 22 Mar 2016 14:23:16 +0100
changeset 36690 06b714373aa4
parent 9882 a89465baa9fd
permissions -rw-r--r--
8151810: for-in iteration does not provide per-iteration scope Reviewed-by: attila, lagergren
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7210
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
     1
/*
9087
e9e44877cd18 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 8036
diff changeset
     2
 * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
7210
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
     4
 *
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
     8
 *
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    13
 * accompanied this code).
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    14
 *
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    18
 *
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    21
 * questions.
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    22
 */
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    23
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    24
/*
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    25
 * @test
7848
884a6d60b235 7010194: several langtools regression failures after JSR 292 changes (b123)
mcimadamore
parents: 7210
diff changeset
    26
 * @bug 6999067 7010194
7210
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    27
 * @summary cast for invokeExact call gets redundant cast to <type> warnings
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    28
 * @author mcimadamore
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    29
 *
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    30
 * @compile -Werror -Xlint:cast XlintWarn.java
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    31
 */
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    32
9082
53409a3a93f8 7028405: (javac) remove unused JSR-292 code
ksrini
parents: 8036
diff changeset
    33
import java.lang.invoke.*;
7210
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    34
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    35
class XlintWarn {
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    36
    void test(MethodHandle mh) throws Throwable {
7848
884a6d60b235 7010194: several langtools regression failures after JSR 292 changes (b123)
mcimadamore
parents: 7210
diff changeset
    37
        int i1 = (int)mh.invokeExact();
9882
a89465baa9fd 7052782: Two langtools regression tests fail due to fix for 7034977 which removed the invokeGeneric method
jjh
parents: 9091
diff changeset
    38
        int i2 = (int)mh.invoke();
8036
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    39
        int i3 = (int)mh.invokeWithArguments();
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    40
    }
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    41
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    42
    void test2(MethodHandle mh) throws Throwable {
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    43
        int i1 = (int)(mh.invokeExact());
9882
a89465baa9fd 7052782: Two langtools regression tests fail due to fix for 7034977 which removed the invokeGeneric method
jjh
parents: 9091
diff changeset
    44
        int i2 = (int)(mh.invoke());
8036
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    45
        int i3 = (int)(mh.invokeWithArguments());
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    46
    }
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    47
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    48
    void test3(MethodHandle mh) throws Throwable {
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    49
        int i1 = (int)((mh.invokeExact()));
9882
a89465baa9fd 7052782: Two langtools regression tests fail due to fix for 7034977 which removed the invokeGeneric method
jjh
parents: 9091
diff changeset
    50
        int i2 = (int)((mh.invoke()));
8036
17b976649c61 6992698: JSR 292: remove support for transient syntax in polymorphic signature calls
mcimadamore
parents: 7848
diff changeset
    51
        int i3 = (int)((mh.invokeWithArguments()));
7210
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    52
    }
8dd5f907461e 6999067: cast for invokeExact call gets redundant cast to <type> warnings
mcimadamore
parents:
diff changeset
    53
}