jdk/test/demo/jvmti/hprof/UseAllBytecodes.java
author duke
Wed, 05 Jul 2017 16:39:36 +0200
changeset 879 78a96e2cb6e9
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1996-2005 Sun Microsystems, Inc.  All Rights Reserved.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
        A simple Java class definition that helps self-test the runtime
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
        interpreter.  Used for getfield/putfield, invoke* opcodes and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
        their _quick variants.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
        See src/share/java/runtime/selftest.c for details of the test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
        environment.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/* Used to be sun/misc/SelfTest.java */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
interface UseAllBytecodesInterface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    public void test_an_interface(int p1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
public class UseAllBytecodes implements UseAllBytecodesInterface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
        public int i1, i2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
        public float f1, f2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
        public double d1, d2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
        public long l1, l2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        public static int si1, si2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        public static float sf1, sf2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        public static double sd1, sd2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        public static long sl1, sl2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
        public UseAllBytecodesInterface interfaceObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        public int multi[][][];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        public UseAllBytecodes()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                /*      This constructor is not intended to ever be run.  It is here
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                        to force CONSTANT_Methodref constants into the CP */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                set_i1(11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
                set_i2(22);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                set_f1(1.1f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                set_f2(2.2f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                set_d1(1.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                set_d2(2.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                set_l1(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                set_l2(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                set_si1(33);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                set_si2(44);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                set_sf1(3.3f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
                set_sf2(4.4f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                set_sd1(3.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                set_sd2(4.0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                set_sl1(5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                set_sl2(6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                test_areturn();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                test_athrow1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                test_athrow2();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                test_athrow3();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                test_athrow4();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                /*      This puts a CONSTANT_InterfaceMethodref into the CP */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                interfaceObject.test_an_interface(1234);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                /*      This creates an array and puts it into the CP */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                multi = new int[2][3][4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        public UseAllBytecodes(int p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                i1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                i2 = 12345678;  /* This puts a CONSTANT_Integer into the CP */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                d1 = (double) p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                d2 = 1.2e234;   /* This puts a CONSTANT_Double into the CP */
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 UseAllBytecodes(int p1, int p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                i1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                i2 = p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        /*      These methods should return something other than their
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                arguments, so the self test can easily determine that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
                the correct value was returned. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        public int set_i1(int p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                i1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                return i1 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        public int set_i2(int p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                i2 = p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                return i2 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        public float set_f1(float p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                f1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                return f1 + 1.0e34f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        public float set_f2(float p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                f2 = p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                return f2 + 1.0e34f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        public double set_d1(double p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
                d1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                return d1 + 1.0e234;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        public double set_d2(double p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                d2 = p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                return d2 + 1.0e234;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        public long set_l1(long p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                l1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                return l1 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        public long set_l2(long p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                l2 = p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                return l2 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        public static void set_si1(int p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                si1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        public static void set_si2(int p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                si2 = p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        public static void set_sf1(float p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                sf1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        public static void set_sf2(float p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                sf2 = p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        public static void set_sd1(double p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                sd1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        public static void set_sd2(double p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                sd2 = p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        public static void set_sl1(long p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                sl1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        public static void set_sl2(long p2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                sl2 = p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        public UseAllBytecodes test_areturn()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        /*      This method does the same thing as set_i1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                It is here to test the invokeinterface opcode. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        public void test_an_interface(int p1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                i1 = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        /*      The following 10 methods test various permutations of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                try-and-catch. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        public static void test_athrow1() throws NullPointerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                try
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                        si1 = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                        throw new NullPointerException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                catch (Exception e)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                        si1 = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        public static void test_athrow2()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                int i = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                try
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                        si1 = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
                        test_athrow1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                catch (Exception e)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                        // This should *not* catch the exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                        // should be caught in test_athrow1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                        si1 = i + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        public static void test_athrow3()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                int i = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                try
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                        // Ultimately throws NullPointerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
                        si1 = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                        si2 = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                        test_athrow5();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                catch (NullPointerException np)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                        si1 = i + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                catch (NoSuchMethodException e)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
                        si2 = i + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
                si1++;  // total is 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        public static void test_athrow4()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                int i = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                try
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                        // Ultimately throws NoSuchMethodException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                        si1 = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                        si2 = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                        test_athrow7();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                catch (NullPointerException e)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                        si1 = i + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                catch (NoSuchMethodException nsm)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                        si2 = i + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
                si2++;  // total is 4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        public static void test_throw_nosuchmethod() throws NoSuchMethodException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                throw new NoSuchMethodException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        public static void test_throw_nullpointer() throws NullPointerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                throw new NullPointerException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        public static void test_athrow5() throws NullPointerException, NoSuchMethodException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                test_athrow6();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        public static void test_athrow6() throws NullPointerException, NoSuchMethodException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                test_throw_nullpointer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        public static void test_athrow7() throws NullPointerException, NoSuchMethodException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                test_athrow8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        public static void test_athrow8() throws NullPointerException, NoSuchMethodException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                test_throw_nosuchmethod();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
}