test/runtime/7116786/Test7116786.java

Thu, 18 Jul 2013 03:38:10 -0700

author
cl
date
Thu, 18 Jul 2013 03:38:10 -0700
changeset 5396
bb416ee2a79b
parent 4838
aa758f0c5b1c
child 6872
c77d5db18942
permissions
-rw-r--r--

Added tag jdk8-b99 for changeset 81b6cb70717c

kamg@3992 1 /*
hseigel@4838 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
kamg@3992 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
kamg@3992 4 *
kamg@3992 5 * This code is free software; you can redistribute it and/or modify it
kamg@3992 6 * under the terms of the GNU General Public License version 2 only, as
kamg@3992 7 * published by the Free Software Foundation.
kamg@3992 8 *
kamg@3992 9 * This code is distributed in the hope that it will be useful, but WITHOUT
kamg@3992 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
kamg@3992 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kamg@3992 12 * version 2 for more details (a copy is included in the LICENSE file that
kamg@3992 13 * accompanied this code).
kamg@3992 14 *
kamg@3992 15 * You should have received a copy of the GNU General Public License version
kamg@3992 16 * 2 along with this work; if not, write to the Free Software Foundation,
kamg@3992 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
kamg@3992 18 *
kamg@3992 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
kamg@3992 20 * or visit www.oracle.com if you need additional information or have any
kamg@3992 21 * questions.
kamg@3992 22 *
kamg@3992 23 */
kamg@3992 24
kamg@3992 25 /*
kamg@3992 26 * @test Test7116786
kamg@3992 27 * @summary verify that VerifyError messages are as expected
kamg@3992 28 * @library testcases.jar
kamg@3992 29 * @run main/othervm -Xverify:all Test7116786
kamg@3992 30 */
kamg@3992 31
kamg@3992 32
kamg@3992 33 /**
kamg@3992 34 * This class contains information regarding when a VerifyError is thrown
kamg@3992 35 * in the verifier. Most of the data is informational-only, and can be
kamg@3992 36 * used to track down where and why VerifyErrors are thrown. As such it
kamg@3992 37 * is possible the information may go out-of-date.
kamg@3992 38 *
kamg@3992 39 * The only fields used for the purpose of testing is the 'caseName' and
kamg@3992 40 * the 'message'. The 'caseName' corresponds to a classfile which exhibits
kamg@3992 41 * the VerifyError, and the 'message' is a regular expression which we expect
kamg@3992 42 * to match the verify error message. If the 'message' doesn't match what
kamg@3992 43 * we expect, it warrents investigation to see if we are still triggering
kamg@3992 44 * the VerifyError that we expect. It could simply just be that the message
kamg@3992 45 * changed, which is fine.
kamg@3992 46 *
kamg@3992 47 * Some cases are not testable, either because the code is probably unreachable
kamg@3992 48 * or the test classfile would be too onerous to create. These cases are
kamg@3992 49 * marked with 'testable' == false, and the test runner will skip them.
kamg@3992 50 */
kamg@3992 51 class Case {
kamg@3992 52 private String caseName; // Name of the case
kamg@3992 53 private String file; // Source file where VerifyError is thrown
kamg@3992 54 private String location; // enclosing function or switch case
kamg@3992 55 private String description; // What causes this VerifyError
kamg@3992 56 private String message; // The VerifyError message used.
kamg@3992 57
kamg@3992 58 private boolean testable; // Whether this case is testable or not.
kamg@3992 59
kamg@3992 60 public Case(String caseName, String file, boolean testable,
kamg@3992 61 String location, String description, String message) {
kamg@3992 62 this.caseName = caseName;
kamg@3992 63 this.file = file;
kamg@3992 64 this.testable = testable;
kamg@3992 65 this.location = location;
kamg@3992 66 this.description = description;
kamg@3992 67 this.message = message;
kamg@3992 68 }
kamg@3992 69
kamg@3992 70 String getCaseName() { return this.caseName; }
kamg@3992 71 String getFile() { return this.file; }
kamg@3992 72 String getLocation() { return this.location; }
kamg@3992 73 String getDescription() { return this.description; }
kamg@3992 74 String getMessage() { return this.message; }
kamg@3992 75
kamg@3992 76 boolean isTestable() { return this.testable; }
kamg@3992 77 }
kamg@3992 78
kamg@3992 79 /**
kamg@3992 80 * These are the locations in the source code where VerifyErrors are thrown
kamg@3992 81 * as of today, 2012/07/18. These may change as the verification code is
kamg@3992 82 * modified, which is ok. This test is trying to provide coverage for all
kamg@3992 83 * VerifyErrors (just to make sure there are no crashes) and it's probably
kamg@3992 84 * not necessary to update it every time the VM changes.
kamg@3992 85 */
kamg@3992 86 class VerifyErrorCases {
kamg@3992 87 public static final Case[] cases = {
kamg@3992 88
kamg@3992 89 new Case("case00", "stackMapFrame.cpp", true, "pop_stack_ex",
kamg@3992 90 "stack underflow",
kamg@3992 91 "Operand stack underflow"),
kamg@3992 92
kamg@3992 93 new Case("case01", "stackMapFrame.cpp", true, "pop_stack_ex",
kamg@3992 94 "stack pop not assignable to expected",
kamg@3992 95 "Bad type on operand stack"),
kamg@3992 96
kamg@3992 97 new Case("case02", "stackMapFrame.cpp", true, "get_local",
kamg@3992 98 "local index out-of-bounds",
kamg@3992 99 "Local variable table overflow"),
kamg@3992 100
kamg@3992 101 new Case("case03", "stackMapFrame.cpp", true, "get_local",
kamg@3992 102 "local not assignable to expected",
kamg@3992 103 "Bad local variable type"),
kamg@3992 104
kamg@3992 105 new Case("case04", "stackMapFrame.cpp", true, "get_local_2",
kamg@3992 106 "local index out-of-bounds [type2]",
kamg@3992 107 "get long/double overflows locals"),
kamg@3992 108
kamg@3992 109 new Case("case05", "stackMapFrame.cpp", true, "get_local_2",
kamg@3992 110 "local not assignabled to expected [type2]",
kamg@3992 111 "Bad local variable type"),
kamg@3992 112
kamg@3992 113 /* Unreachable: Can't split long/double on stack */
kamg@3992 114 new Case("case06", "stackMapFrame.cpp", false, "get_local_2",
kamg@3992 115 "local second-word not assignabled to expected",
kamg@3992 116 "Bad local variable type"),
kamg@3992 117
kamg@3992 118 new Case("case07", "stackMapFrame.cpp", true, "set_local",
kamg@3992 119 "local index out-of-bounds",
kamg@3992 120 "Local variable table overflow"),
kamg@3992 121
kamg@3992 122 new Case("case08", "stackMapFrame.cpp", true, "set_local_2",
kamg@3992 123 "local index out-of-bounds [type2]",
kamg@3992 124 "Local variable table overflow"),
kamg@3992 125
kamg@3992 126 new Case("case09", "stackMapFrame.hpp", true, "push_stack",
kamg@3992 127 "stack overflow",
kamg@3992 128 "Operand stack overflow"),
kamg@3992 129
kamg@3992 130 new Case("case10", "stackMapFrame.hpp", true, "push_stack_2",
kamg@3992 131 "stack overflow [type2]",
kamg@3992 132 "Operand stack overflow"),
kamg@3992 133
kamg@3992 134 new Case("case11", "stackMapFrame.hpp", true, "pop_stack",
kamg@3992 135 "stack underflow",
kamg@3992 136 "Operand stack underflow"),
kamg@3992 137
kamg@3992 138 new Case("case12", "stackMapTable.cpp", true, "StackMapTable ctor",
kamg@3992 139 "stackmap offset beyond code size",
kamg@3992 140 "StackMapTable error: bad offset"),
kamg@3992 141
kamg@3992 142 new Case("case13", "stackMapTable.cpp", true, "match_stackmap",
kamg@3992 143 "no stackmap frame at expected location",
kamg@3992 144 "Expecting a stackmap frame at branch target "),
kamg@3992 145
kamg@3992 146 new Case("case14", "stackMapTable.cpp", true, "check_jump_target",
kamg@3992 147 "no stackmap frame at jump location or bad jump",
kamg@3992 148 "Inconsistent stackmap frames at branch target "),
kamg@3992 149
kamg@3992 150 new Case("case15", "stackMapTable.cpp", true, "check_new_object",
kamg@3992 151 "backward jump with uninit",
kamg@3992 152 "Uninitialized object exists on backward branch "),
kamg@3992 153
kamg@3992 154 /* Unreachable: wide instructions verified during bytecode analysis */
kamg@3992 155 new Case("case16", "verifier.cpp", false, "loop header",
kamg@3992 156 "bad op in wide instruction",
kamg@3992 157 "Bad wide instruction"),
kamg@3992 158
kamg@3992 159 new Case("case17", "verifier.cpp", true, "case iaload",
kamg@3992 160 "TOS not X array",
kamg@3992 161 "Bad type on operand stack in iaload"),
kamg@3992 162
kamg@3992 163 new Case("case18", "verifier.cpp", true, "case baload",
kamg@3992 164 "TOS not X array",
kamg@3992 165 "Bad type on operand stack in baload"),
kamg@3992 166
kamg@3992 167 new Case("case19", "verifier.cpp", true, "case caload",
kamg@3992 168 "TOS not X array",
kamg@3992 169 "Bad type on operand stack in caload"),
kamg@3992 170
kamg@3992 171 new Case("case20", "verifier.cpp", true, "case saload",
kamg@3992 172 "TOS not X array",
kamg@3992 173 "Bad type on operand stack in saload"),
kamg@3992 174
kamg@3992 175 new Case("case21", "verifier.cpp", true, "case laload",
kamg@3992 176 "TOS not X array",
kamg@3992 177 "Bad type on operand stack in laload"),
kamg@3992 178
kamg@3992 179 new Case("case22", "verifier.cpp", true, "case faload",
kamg@3992 180 "TOS not X array",
kamg@3992 181 "Bad type on operand stack in faload"),
kamg@3992 182
kamg@3992 183 new Case("case23", "verifier.cpp", true, "case daload",
kamg@3992 184 "TOS not X array",
kamg@3992 185 "Bad type on operand stack in daload"),
kamg@3992 186
kamg@3992 187 new Case("case24", "verifier.cpp", true, "case aaload",
kamg@3992 188 "TOS not X array",
kamg@3992 189 "Bad type on operand stack in aaload"),
kamg@3992 190
kamg@3992 191 new Case("case25", "verifier.cpp", true, "case iastore",
kamg@3992 192 "TOS not int array",
kamg@3992 193 "Bad type on operand stack in iastore"),
kamg@3992 194
kamg@3992 195 new Case("case26", "verifier.cpp", true, "case bastore",
kamg@3992 196 "TOS not byte array",
kamg@3992 197 "Bad type on operand stack in bastore"),
kamg@3992 198
kamg@3992 199 new Case("case27", "verifier.cpp", true, "case castore",
kamg@3992 200 "TOS not char array",
kamg@3992 201 "Bad type on operand stack in castore"),
kamg@3992 202
kamg@3992 203 new Case("case28", "verifier.cpp", true, "case sastore",
kamg@3992 204 "TOS not short array",
kamg@3992 205 "Bad type on operand stack in sastore"),
kamg@3992 206
kamg@3992 207 new Case("case29", "verifier.cpp", true, "case lastore",
kamg@3992 208 "TOS not long array",
kamg@3992 209 "Bad type on operand stack in lastore"),
kamg@3992 210
kamg@3992 211 new Case("case30", "verifier.cpp", true, "case fastore",
kamg@3992 212 "TOS not float array",
kamg@3992 213 "Bad type on operand stack in fastore"),
kamg@3992 214
kamg@3992 215 new Case("case31", "verifier.cpp", true, "case dastore",
kamg@3992 216 "TOS not double array",
kamg@3992 217 "Bad type on operand stack in dastore"),
kamg@3992 218
kamg@3992 219 new Case("case32", "verifier.cpp", true, "case aastore",
kamg@3992 220 "TOS not object array",
kamg@3992 221 "Bad type on operand stack in aastore"),
kamg@3992 222
kamg@3992 223 /* Unreachable: In order to hit this case, we would need a
kamg@3992 224 * category2_1st at TOS which is not possible. */
kamg@3992 225 new Case("case33", "verifier.cpp", false, "case pop2",
kamg@3992 226 "TOS is category2_1st (would split)",
kamg@3992 227 "Bad type on operand stack in pop2"),
kamg@3992 228
kamg@3992 229 /* Unreachable: In order to hit this case, we would need a
kamg@3992 230 * category2_1st at stack depth 2 with category_1 on TOS which is not
kamg@3992 231 * possible. */
kamg@3992 232 new Case("case34", "verifier.cpp", false, "case dup_x2",
kamg@3992 233 "TOS-1 is category2_1st (would split)",
kamg@3992 234 "Bad type on operand stack in dup_x2"),
kamg@3992 235
kamg@3992 236 /* Unreachable: In order to hit this case, we would need a
kamg@3992 237 * category2_1st at TOS which is not possible. */
kamg@3992 238 new Case("case35", "verifier.cpp", false, "case dup2",
kamg@3992 239 "TOS-1 is category2_1st (would split)",
kamg@3992 240 "Bad type on operand stack in dup2"),
kamg@3992 241
kamg@3992 242 /* Unreachable: In order to hit this case, we would need a
kamg@3992 243 * category2_1st at TOS which is not possible. */
kamg@3992 244 new Case("case36", "verifier.cpp", false, "case dup2_x1",
kamg@3992 245 "TOS-1 is category2_1st (would split)",
kamg@3992 246 "Bad type on operand stack in dup2_x1"),
kamg@3992 247
kamg@3992 248 /* Unreachable: In order to hit this case, we would need a
kamg@3992 249 * category2_1st at TOS which is not possible. */
kamg@3992 250 new Case("case37", "verifier.cpp", false, "case dup2_x2",
kamg@3992 251 "TOS-1 is category2_1st (would split)",
kamg@3992 252 "Bad type on operand stack in dup2_x2"),
kamg@3992 253
kamg@3992 254 /* Unreachable: In order to hit this case, we would need a
kamg@3992 255 * category2_1st at stack depth 3 with either 2 category_1 or 1
kamg@3992 256 * category_2 on TOS, which is not possible. */
kamg@3992 257 new Case("case38", "verifier.cpp", false, "case dup2_x2",
kamg@3992 258 "TOS-3 is category2_1st (would split)",
kamg@3992 259 "Bad type on operand stack in dup2_x2"),
kamg@3992 260
kamg@3992 261 new Case("case39", "verifier.cpp", true, "case return",
kamg@3992 262 "return type of method is not void",
kamg@3992 263 "Method expects a return value"),
kamg@3992 264
kamg@3992 265 new Case("case40", "verifier.cpp", true, "case return",
kamg@3992 266 "return with uninitialized this ",
kamg@3992 267 "Constructor must call super() or this() before return"),
kamg@3992 268
kamg@3992 269 new Case("case41", "verifier.cpp", true, "case new",
kamg@3992 270 "cp index not a class type",
kamg@3992 271 "Illegal new instruction"),
kamg@3992 272
kamg@3992 273 new Case("case42", "verifier.cpp", true, "case arraylength",
kamg@3992 274 "TOS is not an array",
kamg@3992 275 "Bad type on operand stack in arraylength"),
kamg@3992 276
kamg@3992 277 new Case("case43", "verifier.cpp", true, "case multianewarray",
kamg@3992 278 "CP index does not refer to array type",
kamg@3992 279 "Illegal constant pool index in multianewarray instruction"),
kamg@3992 280
kamg@3992 281 new Case("case44", "verifier.cpp", true, "case multianewarray",
kamg@3992 282 "Bad dimension (<1) or does not match CP signature",
kamg@3992 283 "Illegal dimension in multianewarray instruction: "),
kamg@3992 284
kamg@3992 285 new Case("case45", "verifier.cpp", true, "case default",
kamg@3992 286 "Unrecognized bytecode",
kamg@3992 287 "Bad instruction: "),
kamg@3992 288
kamg@3992 289 new Case("case46", "verifier.cpp", true, "loop end",
kamg@3992 290 "control flow falls off method",
kamg@3992 291 "Control flow falls through code end"),
kamg@3992 292
kamg@3992 293 new Case("case47", "verifier.cpp", true, "generate_code_data",
kamg@3992 294 "illegal bytecode via RawBytecodeStream (breakpoint)",
kamg@3992 295 "Bad instruction"),
kamg@3992 296
kamg@3992 297 new Case("case48", "verifier.cpp", true, "generate_code_data",
kamg@3992 298 "illegal bytecode via RawBytecodeStream (other illegal)",
kamg@3992 299 "Bad instruction"),
kamg@3992 300
kamg@3992 301 new Case("case49", "verifier.cpp", true,
kamg@3992 302 "verify_exception_handler_table",
kamg@3992 303 "catch_type is not throwable",
kamg@3992 304 "Catch type is not a subclass of Throwable in " +
kamg@3992 305 "exception handler "),
kamg@3992 306
kamg@3992 307 new Case("case50", "verifier.cpp", true, "verify_stackmap_table",
kamg@3992 308 "missing a stack map frame @ target location (mid table)",
kamg@3992 309 "Expecting a stack map frame"),
kamg@3992 310
kamg@3992 311 new Case("case51", "verifier.cpp", true, "verify_stackmap_table",
kamg@3992 312 "stack map does not match?",
kamg@3992 313 "Instruction type does not match stack map"),
kamg@3992 314
kamg@3992 315 new Case("case52", "verifier.cpp", true, "verify_stackmap_table",
kamg@3992 316 "missing a stack map frame @ target location (end of table)",
kamg@3992 317 "Expecting a stack map frame"),
kamg@3992 318
kamg@3992 319 new Case("case53", "verifier.cpp", true,
kamg@3992 320 "verify_exception_handler_targets",
kamg@3992 321 "stackmap mismatch at exception handler",
kamg@3992 322 "Stack map does not match the one at exception handler "),
kamg@3992 323
kamg@3992 324 new Case("case54", "verifier.cpp", true, "verify_cp_index",
kamg@3992 325 "constant pool index is out-of-bounds",
kamg@3992 326 "Illegal constant pool index "),
kamg@3992 327
kamg@3992 328 new Case("case55", "verifier.cpp", true, "verify_cp_type",
kamg@3992 329 "constant pool entry is not expected type",
kamg@3992 330 "Illegal type at constant pool entry "),
kamg@3992 331
kamg@3992 332 new Case("case56", "verifier.cpp", true, "verify_cp_class_type",
kamg@3992 333 "constant pool entry is not an object type",
kamg@3992 334 "Illegal type at constant pool entry "),
kamg@3992 335
kamg@3992 336 /* Unreachable: verify_cp_type gates this case */
kamg@3992 337 new Case("case57", "verifier.cpp", false, "verify_ldc",
kamg@3992 338 "invalid constant pool index in ldc",
kamg@3992 339 "Invalid index in ldc"),
kamg@3992 340
hseigel@4838 341 /* No longer a valid test case for bytecode version >= 51. Nonzero
hseigel@4838 342 * padding bytes are permitted with lookupswitch and tableswitch
hseigel@4838 343 * bytecodes as of JVMS 3d edition */
hseigel@4838 344 new Case("case58", "verifier.cpp", false, "verify_switch",
kamg@3992 345 "bad switch padding",
hseigel@4838 346 "Nonzero padding byte in lookupswitch or tableswitch"),
kamg@3992 347
kamg@3992 348 new Case("case59", "verifier.cpp", true, "verify_switch",
kamg@3992 349 "tableswitch low is greater than high",
kamg@3992 350 "low must be less than or equal to high in tableswitch"),
kamg@3992 351
kamg@3992 352 /* Unreachable on 64-bit? Only way to get here is to overflow
kamg@3992 353 * the 'keys' variable which can't happen on 64-bit since we're dealing
kamg@3992 354 * with 32-bit values. Perhaps reachable on 32-bit but the
kamg@3992 355 * triggering class would be quite large */
kamg@3992 356 new Case("case60", "verifier.cpp", false, "verify_switch",
kamg@3992 357 "high - low + 1 < 0 (overflow?)",
kamg@3992 358 "too many keys in tableswitch"),
kamg@3992 359
kamg@3992 360 /* Would have to create a 16G classfile to trip this. Possible but
kamg@3992 361 * not reasonable to do in a test. */
kamg@3992 362 new Case("case61", "verifier.cpp", false, "verify_switch",
kamg@3992 363 "lookupswitch keys < 0",
kamg@3992 364 "number of keys in lookupswitch less than 0"),
kamg@3992 365
kamg@3992 366 new Case("case62", "verifier.cpp", true, "verify_switch",
kamg@3992 367 "lookupswitch keys out-of-order",
kamg@3992 368 "Bad lookupswitch instruction"),
kamg@3992 369
kamg@3992 370 /* Unreachable: Class file parser verifies Fieldref contents */
kamg@3992 371 new Case("case63", "verifier.cpp", false, "verify_field_instructions",
kamg@3992 372 "referenced class is not an CP object",
kamg@3992 373 "Expecting reference to class in class "),
kamg@3992 374
kamg@3992 375 new Case("case64", "verifier.cpp", true, "verify_field_instructions",
kamg@3992 376 "TOS not assignable to field type in putfield",
kamg@3992 377 "Bad type on operand stack in putfield"),
kamg@3992 378
kamg@3992 379 new Case("case65", "verifier.cpp", true, "verify_field_instructions",
kamg@3992 380 "TOS not assignable to class when accessing protected field",
kamg@3992 381 "Bad access to protected data in getfield"),
kamg@3992 382
kamg@3992 383 new Case("case66", "verifier.cpp", true, "verify_invoke_init",
kamg@3992 384 "Uninit_this is not of the current type or it's supertype",
kamg@3992 385 "Bad <init> method call"),
kamg@3992 386
kamg@3992 387 /* Unreachable: Stack map parsing ensures valid type and new
kamg@3992 388 * instructions have a valid BCI. */
kamg@3992 389 new Case("case67", "verifier.cpp", false, "verify_invoke_init",
kamg@3992 390 "Uninit type with bad new instruction index",
kamg@3992 391 "Expecting new instruction"),
kamg@3992 392
kamg@3992 393 new Case("case68", "verifier.cpp", true, "verify_invoke_init",
kamg@3992 394 "calling other class's <init> method",
kamg@3992 395 "Call to wrong <init> method"),
kamg@3992 396
kamg@3992 397 new Case("case69", "verifier.cpp", true, "verify_invoke_init",
kamg@3992 398 "Calling protected <init> and type unassignable from current",
kamg@3992 399 "Bad access to protected <init> method"),
kamg@3992 400
kamg@3992 401 new Case("case70", "verifier.cpp", true, "verify_invoke_init",
kamg@3992 402 "TOS is not an uninitialized (or Uninit_this) type",
kamg@3992 403 "Bad operand type when invoking <init>"),
kamg@3992 404
kamg@3992 405 new Case("case71", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 406 "Arg count in instruction doesn't match signature",
kamg@3992 407 "Inconsistent args count operand in invokeinterface"),
kamg@3992 408
kamg@3992 409 new Case("case72", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 410 "Non-zero pad in invokeinterface",
kamg@3992 411 "Fourth operand byte of invokeinterface must be zero"),
kamg@3992 412
kamg@3992 413 new Case("case73", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 414 "Non-zero pad in invokedynamic",
kamg@3992 415 "Third and fourth operand bytes of " +
kamg@3992 416 "invokedynamic must be zero"),
kamg@3992 417
kamg@3992 418 new Case("case74", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 419 "Non-invokespecial trying to invoke a '<' method",
kamg@3992 420 "Illegal call to internal method"),
kamg@3992 421
kamg@3992 422 new Case("case75", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 423 "invokespecial and current unassignable from referenced type",
kamg@3992 424 "Bad invokespecial instruction: current class isn't " +
kamg@3992 425 "assignable to reference class."),
kamg@3992 426
kamg@3992 427 new Case("case76", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 428 "TOS not assignable to current when calling protected method",
kamg@3992 429 "Bad access to protected data in invokevirtual"),
kamg@3992 430
kamg@3992 431 /* Unreachable: class file parser enforces void signature */
kamg@3992 432 new Case("case77", "verifier.cpp", false, "verify_invoke_instructions",
kamg@3992 433 "<init> method is not void return",
kamg@3992 434 "Return type must be void in <init> method"),
kamg@3992 435
kamg@3992 436 new Case("case78", "verifier.cpp", true, "get_newarray_type",
kamg@3992 437 "newarray type invalid",
kamg@3992 438 "Illegal newarray instruction"),
kamg@3992 439
kamg@3992 440 new Case("case79", "verifier.cpp", true, "verify_return_value",
kamg@3992 441 "void return from method which has a return value",
kamg@3992 442 "Method expects a return value"),
kamg@3992 443
kamg@3992 444 new Case("case80", "verifier.cpp", true, "verify_return_value",
kamg@3992 445 "TOS type does not match signature",
kamg@3992 446 "Bad return type"),
kamg@3992 447
kamg@3992 448 new Case("case81", "verifier.cpp", true, "verify_stackmap_table",
kamg@3992 449 "stack map does not match (flags)",
kamg@3992 450 "Instruction type does not match stack map")
kamg@3992 451 };
kamg@3992 452 }
kamg@3992 453
kamg@3992 454 public class Test7116786 {
kamg@3992 455 public static void main(String argv[]) throws Exception {
kamg@3992 456 for (Case c : VerifyErrorCases.cases) {
kamg@3992 457 System.out.println("******** " + c.getCaseName() + " ********");
kamg@3992 458 if (c.isTestable()) {
kamg@3992 459 try {
kamg@3992 460 ClassLoader cl = Test7116786.class.getClassLoader();
kamg@3992 461 Class<?> cls = Class.forName(c.getCaseName(), true, cl);
kamg@3992 462 throw new RuntimeException(
kamg@3992 463 "++ FAIL: No verify error encountered");
kamg@3992 464 } catch (VerifyError ve) {
kamg@3992 465 String message = c.getMessage();
kamg@3992 466 String veMessage = ve.getMessage();
kamg@3992 467 System.out.print(veMessage);
kamg@3992 468 if (!veMessage.startsWith(message)) {
kamg@3992 469 // We're not seeing the message we expect. Could be
kamg@3992 470 // that we've gotten the wrong VerifyError case, or
kamg@3992 471 // maybe the message changed.
kamg@3992 472 System.out.println("++ FAIL? " +
kamg@3992 473 "Message does not match what was expected: " +
kamg@3992 474 message);
kamg@3992 475 continue;
kamg@3992 476 }
kamg@3992 477 if (!veMessage.contains("Exception Details:") &&
kamg@3992 478 !veMessage.contains("Reason:")) {
kamg@3992 479 System.out.println("++ FAIL: No details found");
kamg@3992 480 throw new RuntimeException("FAIL: No details found");
kamg@3992 481 }
kamg@3992 482 System.out.println("++ PASS");
kamg@3992 483 }
kamg@3992 484 } else {
kamg@3992 485 System.out.println("++ SKIPPED");
kamg@3992 486 }
kamg@3992 487 }
kamg@3992 488 }
kamg@3992 489 }

mercurial