test/jdk/com/sun/jdi/InvokeTest.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:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 24973
diff changeset
     2
 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/**
44423
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 30376
diff changeset
    25
 * @test
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 30376
diff changeset
    26
 * @bug 4451941 4527072
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 30376
diff changeset
    27
 * @summary Test argument types for invoke
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 30376
diff changeset
    28
 * @author Robert Field
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *
44423
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 30376
diff changeset
    30
 * @library ..
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 30376
diff changeset
    31
 *
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 30376
diff changeset
    32
 * @run build  TestScaffold VMConnection TargetListener TargetAdapter
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 30376
diff changeset
    33
 * @run compile -g InvokeTest.java
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 30376
diff changeset
    34
 * @run driver InvokeTest
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import com.sun.jdi.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import com.sun.jdi.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import com.sun.jdi.request.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    /********** target program **********/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
class InvokeTarg {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    static InvokeTarg myself = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    boolean[] aBooleanArray = new boolean[] {true, true};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    byte[] aByteArray = new byte[] {4, 2};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    char[] aCharArray = new char[] {'k', 'p'};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    short[] aShortArray = new short[] {55,12, 12};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    int[] aIntArray = new int[] {6, 3, 1};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    long[] aLongArray = new long[] {3423423};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    float[] aFloatArray = new float[] {(float)2.1};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    double[] aDoubleArray = new double[] {3.141595358979};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    boolean[][] aBoolean2DArray = new boolean[][]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                                   {{true, false}, {false, true}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    byte[][] aByte2DArray = new byte[][] {{22,66}, {8,9}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    char[][] aChar2DArray = new char[][] {{22,66}, {8,9}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    short[][] aShort2DArray = new short[][] {{22,66}, {8,9}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    int[][] aInt2DArray = new int[][] {{22,66}, {8,9}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    long[][] aLong2DArray = new long[][] {{22,66}, {8,9}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    float[][] aFloat2DArray = new float[][] {{22,66}, {8,9}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    double[][] aDouble2DArray = new double[][] {{22,66}, {8,9}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    String[] aStringArray = new String[] {"testing"};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    String[][] aString2DArray = new String[][]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                                     {{"hi", "there"}, {"oh"}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    Date aDate = new Date();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    Date[] aDateArray = new Date[] {};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    Date[][] aDate2DArray = new Date[][] {{}};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    String aString = "jjxx";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    long longCheck = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    boolean booleanCheck = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    boolean voidCheck = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    Object objectCheck = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public static void main(String[] args){
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        System.out.println("Howdy!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        (new InvokeTarg()).sayHi();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    void sayHi() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    void checkIn() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    boolean invokeVoid() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        voidCheck = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    boolean invokeBoolean(boolean val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        booleanCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    byte invokeByte(byte val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        longCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    char invokeChar(char val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        longCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    short invokeShort(short val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        longCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    int invokeInt(int val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        longCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    long invokeLong(long val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        longCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    float invokeFloat(float val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        longCheck = (long)val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    double invokeDouble(double val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        longCheck = (long)val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    boolean[] invokeBooleanArray(boolean[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    byte[] invokeByteArray(byte[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    char[] invokeCharArray(char[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    short[] invokeShortArray(short[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    int[] invokeIntArray(int[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    long[] invokeLongArray(long[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    float[] invokeFloatArray(float[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    double[] invokeDoubleArray(double[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    boolean[][] invokeBoolean2DArray(boolean[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    byte[][] invokeByte2DArray(byte[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    char[][] invokeChar2DArray(char[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    short[][] invokeShort2DArray(short[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    int[][] invokeInt2DArray(int[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    long[][] invokeLong2DArray(long[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    float[][] invokeFloat2DArray(float[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    double[][] invokeDouble2DArray(double[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    String invokeString(String val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    String[] invokeStringArray(String[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    String[][] invokeString2DArray(String[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    Date invokeDate(Date val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    Date[] invokeDateArray(Date[] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    Date[][] invokeDate2DArray(Date[][] val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    String invokeCombo(int[][] arr, String val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    int[][] invokeCombo2(int[][] val, String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        objectCheck = val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        checkIn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        return val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    /********** test program **********/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
public class InvokeTest extends TestScaffold {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    ReferenceType targetClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    ThreadReference mainThread;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    ObjectReference thisObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    Field longCheckField;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    Field booleanCheckField;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    Field voidCheckField;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    Field objectCheckField;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    Value longValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    Value booleanValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    Value objectValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    Value voidValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    InvokeTest (String args[]) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        super(args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    public static void main(String[] args)      throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        new InvokeTest(args).startTests();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    /********** event handlers **********/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    // not use now
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    public void breakpointReached(BreakpointEvent event) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        println("Got BreakpointEvent");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
        longValue = thisObject.getValue(longCheckField);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        booleanValue = thisObject.getValue(booleanCheckField);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        objectValue = thisObject.getValue(objectCheckField);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        voidValue = thisObject.getValue(voidCheckField);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    /********** test assist **********/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    void invoke(Method method, List args, Value value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        Value returnValue = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            returnValue = thisObject.invokeMethod(mainThread,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
                                                    method, args, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
        } catch ( Exception ee) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            println("Got Exception: " + ee);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
            ee.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
        println("        return val = " + returnValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        // It has to be the same value as what we passed in!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        if (returnValue.equals(value)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
            println("         " + method.name() + " return value matches: "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
                    + value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
            if (value != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
                failure("FAIL: " + method.name() + " returned: " + returnValue +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                        " expected: " + value );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
                println("         " + method.name() + " return value : " + returnValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        Value checkValue = (value instanceof PrimitiveValue)?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                              ((value instanceof BooleanValue)?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
                                        booleanValue : longValue) :
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
                              objectValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    void invoke(String methodName, String methodSig,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
                List args, Value value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        Method method = findMethod(targetClass, methodName, methodSig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        if ( method == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
            failure("FAILED: Can't find method: " + methodName  + " for class = " + targetClass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        invoke(method, args, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    void invoke(String methodName, String methodSig, Value value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                                           throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        List args = new ArrayList(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        args.add(value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        invoke(methodName, methodSig, args, value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    void invoke(String methodName, String methodSig, String fieldName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                                           throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        invoke(methodName, methodSig, fieldValue(fieldName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    private Method toStringMethod;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    Method gettoStringMethod() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        if ( toStringMethod != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            return toStringMethod;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        // We have to find it.  First find java.lang.Object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        List myClasses = vm().allClasses();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        Iterator iter = myClasses.iterator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        ReferenceType objectMirror = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        while (iter.hasNext()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
            ReferenceType xx = (ReferenceType)iter.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
            if (xx.name().equals("java.lang.Object")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
                objectMirror = xx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        if (objectMirror == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        // Then find toSting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        List meths = objectMirror.methods();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
        iter = meths.iterator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        while (iter.hasNext()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
            toStringMethod = (Method)iter.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
            if (toStringMethod.name().equals("toString")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
                return toStringMethod;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
       toStringMethod = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
       return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    // This calls toString on a field
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    protected void callToString(String fieldName) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        // Sorry for this kludgy use of global vars.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        ObjectReference saveObject = thisObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        Method toStringMethod = gettoStringMethod();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        Field theField = targetClass.fieldByName(fieldName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        thisObject = (ObjectReference)thisObject.getValue( theField);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        invoke(toStringMethod, new ArrayList(0), null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        thisObject = saveObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    Value fieldValue(String fieldName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        Field field = targetClass.fieldByName(fieldName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        return thisObject.getValue(field);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    /********** test core **********/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    protected void runTests() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
         * Get to the top of sayHi()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
         * to determine targetClass and mainThread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
        BreakpointEvent bpe = startTo("InvokeTarg", "sayHi", "()V");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        targetClass = bpe.location().declaringType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        mainThread = bpe.thread();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        StackFrame frame = mainThread.frame(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        thisObject = frame.thisObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        longCheckField = targetClass.fieldByName("longCheck");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        booleanCheckField = targetClass.fieldByName("booleanCheck");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
        objectCheckField = targetClass.fieldByName("objectCheck");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        voidCheckField = targetClass.fieldByName("voidCheck");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        callToString("aBooleanArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        invoke("invokeVoid",    "()Z",  new ArrayList(0), vm().mirrorOf(true));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        invoke("invokeBoolean", "(Z)Z", vm().mirrorOf(true));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        invoke("invokeByte",    "(B)B", vm().mirrorOf((byte)14));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
        invoke("invokeChar",    "(C)C", vm().mirrorOf('h'));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        invoke("invokeShort",   "(S)S", vm().mirrorOf((short)54));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        invoke("invokeInt",     "(I)I", vm().mirrorOf((int)414));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        invoke("invokeLong",    "(J)J", vm().mirrorOf((long)140000));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        invoke("invokeFloat",   "(F)F", vm().mirrorOf((float)315));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        invoke("invokeDouble",  "(D)D", vm().mirrorOf((double)181818));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        invoke("invokeBooleanArray",    "([Z)[Z", "aBooleanArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        invoke("invokeByteArray",    "([B)[B", "aByteArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        invoke("invokeCharArray",    "([C)[C", "aCharArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        invoke("invokeShortArray",   "([S)[S", "aShortArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        invoke("invokeIntArray",     "([I)[I", "aIntArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        invoke("invokeLongArray",    "([J)[J", "aLongArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
        invoke("invokeFloatArray",   "([F)[F", "aFloatArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        invoke("invokeDoubleArray",  "([D)[D", "aDoubleArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
        invoke("invokeBoolean2DArray",    "([[Z)[[Z", "aBoolean2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        invoke("invokeByte2DArray",    "([[B)[[B", "aByte2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
        invoke("invokeChar2DArray",    "([[C)[[C", "aChar2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        invoke("invokeShort2DArray",   "([[S)[[S", "aShort2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
        invoke("invokeInt2DArray",     "([[I)[[I", "aInt2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        invoke("invokeLong2DArray",    "([[J)[[J", "aLong2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
        invoke("invokeFloat2DArray",   "([[F)[[F", "aFloat2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        invoke("invokeDouble2DArray",  "([[D)[[D", "aDouble2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
        invoke("invokeString",    "(Ljava/lang/String;)Ljava/lang/String;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
                                  vm().mirrorOf("Howdy"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
        invoke("invokeStringArray",    "([Ljava/lang/String;)[Ljava/lang/String;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
                                  "aStringArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        invoke("invokeString2DArray",    "([[Ljava/lang/String;)[[Ljava/lang/String;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                                  "aString2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        invoke("invokeDate",    "(Ljava/util/Date;)Ljava/util/Date;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                                  "aDate");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        invoke("invokeDateArray",  "([Ljava/util/Date;)[Ljava/util/Date;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
                                  "aDateArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
        invoke("invokeDate2DArray", "([[Ljava/util/Date;)[[Ljava/util/Date;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
                                  "aDate2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
        Value i2 = fieldValue("aInt2DArray");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        Value str = vm().mirrorOf("Later");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        List args = new ArrayList(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        args.add(i2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
        args.add(str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        invoke("invokeCombo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
               "([[ILjava/lang/String;)Ljava/lang/String;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
               args, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        invoke("invokeCombo2",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
               "([[ILjava/lang/String;)[[I",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
               args, i2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
         * resume the target listening for events
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        listenUntilVMDisconnect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
         * deal with results of test
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
         * if anything has called failure("foo") testFailed will be true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        if (!testFailed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            println("InvokeTest: passed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
            throw new Exception("InvokeTest: failed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
}