test/jdk/java/lang/invoke/6987555/Test6987555.java
author phh
Sat, 30 Nov 2019 14:33:05 -0800
changeset 59330 5b96c12f909d
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234541: C1 emits an empty message when it inlines successfully Summary: Use "inline" as the message when successfull Reviewed-by: thartmann, mdoerr Contributed-by: navy.xliu@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8821
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
     1
/*
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
     2
 * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
     4
 *
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
     7
 * published by the Free Software Foundation.
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
     8
 *
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    13
 * accompanied this code).
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    14
 *
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    18
 *
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    21
 * questions.
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    22
 */
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    23
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    24
/**
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    25
 * @test
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    26
 * @bug 6987555
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    27
 * @summary JSR 292 unboxing to a boolean value fails on big-endian SPARC
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    28
 *
9033
a88f5656f05d 6817525: turn on method handle functionality by default for JSR 292
jrose
parents: 8822
diff changeset
    29
 * @run main/othervm -Xint -ea -XX:+UnlockDiagnosticVMOptions -XX:+VerifyMethodHandles Test6987555
8821
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    30
 */
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    31
8822
8145ab9f5f86 7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents: 8821
diff changeset
    32
import java.lang.invoke.*;
8821
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    33
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    34
public class Test6987555 {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    35
    private static final Class   CLASS = Test6987555.class;
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    36
    private static final String  NAME  = "foo";
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    37
    private static final boolean DEBUG = false;
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    38
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    39
    public static void main(String[] args) throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    40
        testboolean();
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    41
        testbyte();
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    42
        testchar();
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    43
        testshort();
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    44
        testint();
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    45
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    46
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    47
    // boolean
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    48
    static void testboolean() throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    49
        doboolean(false);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    50
        doboolean(true);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    51
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    52
    static void doboolean(boolean x) throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    53
        if (DEBUG)  System.out.println("boolean=" + x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    54
        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(boolean.class, boolean.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    55
        MethodHandle mh2 = mh1.asType(MethodType.methodType(boolean.class, Boolean.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    56
        boolean a = (boolean) mh1.invokeExact(x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    57
        boolean b = (boolean) mh2.invokeExact(Boolean.valueOf(x));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    58
        assert a == b : a + " != " + b;
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    59
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    60
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    61
    // byte
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    62
    static void testbyte() throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    63
        byte[] a = new byte[] {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    64
            Byte.MIN_VALUE,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    65
            Byte.MIN_VALUE + 1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    66
            -0x0F,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    67
            -1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    68
            0,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    69
            1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    70
            0x0F,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    71
            Byte.MAX_VALUE - 1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    72
            Byte.MAX_VALUE
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    73
        };
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    74
        for (int i = 0; i < a.length; i++) {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    75
            dobyte(a[i]);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    76
        }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    77
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    78
    static void dobyte(byte x) throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    79
        if (DEBUG)  System.out.println("byte=" + x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    80
        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(byte.class, byte.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    81
        MethodHandle mh2 = mh1.asType(MethodType.methodType(byte.class, Byte.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    82
        byte a = (byte) mh1.invokeExact(x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    83
        byte b = (byte) mh2.invokeExact(Byte.valueOf(x));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    84
        assert a == b : a + " != " + b;
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    85
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    86
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    87
    // char
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    88
    static void testchar() throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    89
        char[] a = new char[] {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    90
            Character.MIN_VALUE,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    91
            Character.MIN_VALUE + 1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    92
            0x000F,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    93
            0x00FF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    94
            0x0FFF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    95
            Character.MAX_VALUE - 1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    96
            Character.MAX_VALUE
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    97
        };
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    98
        for (int i = 0; i < a.length; i++) {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
    99
            dochar(a[i]);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   100
        }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   101
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   102
    static void dochar(char x) throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   103
        if (DEBUG)  System.out.println("char=" + x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   104
        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(char.class, char.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   105
        MethodHandle mh2 = mh1.asType(MethodType.methodType(char.class, Character.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   106
        char a = (char) mh1.invokeExact(x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   107
        char b = (char) mh2.invokeExact(Character.valueOf(x));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   108
        assert a == b : a + " != " + b;
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   109
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   110
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   111
    // short
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   112
    static void testshort() throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   113
        short[] a = new short[] {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   114
            Short.MIN_VALUE,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   115
            Short.MIN_VALUE + 1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   116
            -0x0FFF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   117
            -0x00FF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   118
            -0x000F,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   119
            -1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   120
            0,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   121
            1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   122
            0x000F,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   123
            0x00FF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   124
            0x0FFF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   125
            Short.MAX_VALUE - 1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   126
            Short.MAX_VALUE
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   127
        };
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   128
        for (int i = 0; i < a.length; i++) {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   129
            doshort(a[i]);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   130
        }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   131
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   132
    static void doshort(short x) throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   133
        if (DEBUG)  System.out.println("short=" + x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   134
        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(short.class, short.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   135
        MethodHandle mh2 = mh1.asType(MethodType.methodType(short.class, Short.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   136
        short a = (short) mh1.invokeExact(x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   137
        short b = (short) mh2.invokeExact(Short.valueOf(x));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   138
        assert a == b : a + " != " + b;
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   139
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   140
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   141
    // int
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   142
    static void testint() throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   143
        int[] a = new int[] {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   144
            Integer.MIN_VALUE,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   145
            Integer.MIN_VALUE + 1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   146
            -0x00000FFF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   147
            -0x000000FF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   148
            -0x0000000F,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   149
            -1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   150
            0,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   151
            1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   152
            0x0000000F,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   153
            0x000000FF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   154
            0x00000FFF,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   155
            Integer.MAX_VALUE - 1,
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   156
            Integer.MAX_VALUE
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   157
        };
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   158
        for (int i = 0; i < a.length; i++) {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   159
            doint(a[i]);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   160
        }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   161
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   162
    static void doint(int x) throws Throwable {
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   163
        if (DEBUG)  System.out.println("int=" + x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   164
        MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(int.class, int.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   165
        MethodHandle mh2 = mh1.asType(MethodType.methodType(int.class, Integer.class));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   166
        int a = (int) mh1.invokeExact(x);
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   167
        int b = (int) mh2.invokeExact(Integer.valueOf(x));
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   168
        assert a == b : a + " != " + b;
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   169
    }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   170
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   171
    public static boolean foo(boolean i) { return i; }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   172
    public static byte    foo(byte    i) { return i; }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   173
    public static char    foo(char    i) { return i; }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   174
    public static short   foo(short   i) { return i; }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   175
    public static int     foo(int     i) { return i; }
2836ee97ee27 6839872: remove implementation inheritance from JSR 292 APIs
jrose
parents:
diff changeset
   176
}