jdk/test/com/sun/jdi/EvalArgs.sh
author ohair
Tue, 28 Dec 2010 15:53:50 -0800
changeset 7668 d4a77089c587
parent 5506 202f599c92aa
child 23046 0b0407b1e2a5
permissions -rw-r--r--
6962318: Update copyright year Reviewed-by: xdono
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     4
# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#  @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#  @bug 4663146
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#  @summary Arguments match no method error 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#  @author Jim Holmlund/Suvasis
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#  @run shell/timeout=300 EvalArgs.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#  The bug is that, for example, if a String is passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#  as an arg to a func where an Object is expected,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#  the above error occurs.  jdb doesnt notice that this is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#  legal because String is an instance of Object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
# These are variables that can be set to control execution
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#pkg=untitled7
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
classname=EvalArgs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#compileOptions=-g
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#java="java_g"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
createJavaFile()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    cat <<EOF > $classname.java.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
public class $classname {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    static jj1 myjj1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    static jj2 myjj2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    static oranges myoranges;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    static boolean jjboolean = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    static byte    jjbyte = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    static char    jjchar = 'a';
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    static double  jjdouble = 2.2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    static float   jjfloat = 3.1f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    static int     jjint = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    static long    jjlong = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    static short   jjshort = 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    static int[]   jjintArray = {7, 8};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    static float[] jjfloatArray = {9.1f, 10.2f};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    public static void main(String args[]) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        myjj1 = new jj1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        myjj2 = new jj2();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        myoranges = new oranges();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        // prove that these work
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        System.out.println( ffjj1(myjj1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        System.out.println( ffjj1(myjj2));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        System.out.println("$classname.ffoverload($classname.jjboolean) = " + 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                            $classname.ffoverload($classname.jjboolean));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        System.out.println("$classname.ffoverload($classname.jjbyte) = " + 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                            $classname.ffoverload($classname.jjbyte));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        System.out.println("$classname.ffoverload($classname.jjchar) = " + 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                            $classname.ffoverload($classname.jjchar));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        System.out.println("$classname.ffoverload($classname.jjdouble) = " + 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                            $classname.ffoverload($classname.jjdouble));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        //This doesn't even compile
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        //System.out.println( "ffintArray(jjfloatArray) = " + ffintArray(jjfloatArray));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        gus();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    static void gus() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        int x = 0;             // @1 breakpoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public static String ffjj1(jj1 arg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        return arg.me;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public static String ffjj2(jj2 arg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        return arg.me;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    static String ffboolean(boolean p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        return "ffbool: p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    static String ffbyte(byte p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        return "ffbyte: p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    static String ffchar(char p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        return "ffchar: p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    static String ffdouble(double p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        return "ffdouble: p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    static String fffloat(float p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        return "fffloat: p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    static String ffint(int p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        return "ffint: p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    static String fflong(long p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        return "fflong: p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    static String ffshort(short p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        return "ffshort: p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    static String ffintArray(int[] p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        return "ffintArray: p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    // Overloaded funcs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    public static String ffoverload(jj1 arg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        return arg.me;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    static String ffoverload(boolean p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        return "ffoverload: boolean p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
/***        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    static String ffoverload(byte p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        return "ffoverload: byte p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
***/        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    static String ffoverload(char p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        return "ffoverload: char p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    static String ffoverload(double p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        return "ffoverload: double p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    static String ffoverload(float p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        return "ffoverload: float p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
/***        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    static String ffoverload(int p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        return "ffoverload: int p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
***/        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    static String ffoverload(long p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        return "ffoverload: long p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    static String ffoverload(short p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        return "ffoverload: short p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
      
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    static String ffoverload(int[] p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        return "ffoverload: int array p1 = " + p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
  static class jj1 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    String me;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    jj1() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        me = "jj1name";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        return me;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
  static class jj2 extends jj1 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    jj2() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        super();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        me = "jj2name";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
  static class oranges {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    oranges() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
EOF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
# drive jdb by sending cmds to it and examining its output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
dojdbCmds()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    setBkpts @1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    runToBkpt @1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    # verify that it works ok when arg types are the same as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    # the param types
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    cmd eval "$classname.ffboolean($classname.jjboolean)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    cmd eval "$classname.ffbyte($classname.jjbyte)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    cmd eval "$classname.ffchar($classname.jjchar)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    cmd eval "$classname.ffdouble($classname.jjdouble)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    cmd eval "$classname.fffloat($classname.jjfloat)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    cmd eval "$classname.ffint($classname.jjint)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    cmd eval "$classname.fflong($classname.jjlong)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    cmd eval "$classname.ffshort($classname.jjshort)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    cmd eval "$classname.ffintArray($classname.jjintArray)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    cmd eval "$classname.ffjj1($classname.myjj1)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    # Provide a visual break in the output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    cmd print 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    # Verify mixing primitive types works ok 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    # These should work even though the arg types are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    # not the same because there is only one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    # method with each name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    cmd eval "$classname.ffbyte($classname.jjint)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    cmd eval "$classname.ffchar($classname.jjdouble)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    cmd eval "$classname.ffdouble($classname.jjfloat)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    cmd eval "$classname.fffloat($classname.jjshort)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    cmd eval "$classname.ffint($classname.jjlong)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    cmd eval "$classname.fflong($classname.jjchar)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    cmd eval "$classname.ffshort($classname.jjbyte)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    cmd print 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    # Verify that passing a subclass object works
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    cmd eval "$classname.ffjj1($classname.myjj2)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    cmd eval "$classname.myjj1.toString().equals("jj1name")"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    cmd print 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    # Overloaded methods.  These should pass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    # because there is an exact  match.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    cmd eval "$classname.ffoverload($classname.jjboolean)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    cmd eval "$classname.ffoverload($classname.jjchar)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    cmd eval "$classname.ffoverload($classname.jjdouble)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    cmd eval "$classname.ffoverload($classname.jjfloat)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    cmd eval "$classname.ffoverload($classname.jjlong)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    cmd eval "$classname.ffoverload($classname.jjshort)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    cmd eval "$classname.ffoverload($classname.jjintArray)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    cmd eval "$classname.ffoverload($classname.myjj1)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    cmd eval "$classname.ffoverload($classname.myjj2)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    jdbFailIfPresent "Arguments match no method"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    cmd print 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    cmd print '"These should fail with msg Arguments match multiple methods"'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    # These overload calls should fail because ther
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    # isn't an exact match and jdb isn't smart  enough
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    # to figure out which of several possibilities
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    # should be called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    cmd eval "$classname.ffoverload($classname.jjbyte)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    jdbFailIfNotPresent "Arguments match multiple methods" 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    cmd eval "$classname.ffoverload($classname.jjint)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    jdbFailIfNotPresent "Arguments match multiple methods" 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    cmd print 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    cmd print '"These should fail with InvalidTypeExceptions"'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    cmd eval "$classname.ffboolean($classname.jjbyte)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    jdbFailIfNotPresent "InvalidTypeException" 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    cmd eval "$classname.ffintArray($classname.jjint)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    jdbFailIfNotPresent "InvalidTypeException" 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    cmd eval "$classname.ffintArray($classname.jjfloatArray)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    jdbFailIfNotPresent "InvalidTypeException" 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    cmd eval "$classname.ffjj2($classname.myjj1)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    jdbFailIfNotPresent "InvalidTypeException" 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    cmd eval "$classname.ffjj2($classname.myoranges)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    jdbFailIfNotPresent "InvalidTypeException" 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    cmd quit 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
mysetup()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    if [ -z "$TESTSRC" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        TESTSRC=.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    for ii in . $TESTSRC $TESTSRC/.. ; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        if [ -r "$ii/ShellScaffold.sh" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            . $ii/ShellScaffold.sh 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
            break
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
# You could replace this next line with the contents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
# of ShellScaffold.sh and this script will run just the same.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
mysetup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
runit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
pass