test/runtime/7116786/Test7116786.java

Tue, 05 Aug 2014 09:11:35 -0400

author
hseigel
date
Tue, 05 Aug 2014 09:11:35 -0400
changeset 6960
b2daaf70fab2
parent 6872
c77d5db18942
child 6876
710a3c8b516e
permissions
-rw-r--r--

8046233: VerifyError on backward branch
Summary: Remove check that causes the VerifyError
Reviewed-by: dholmes, coleenp, acorn

kamg@3992 1 /*
hseigel@6872 2 * Copyright (c) 2012, 2014, 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
hseigel@6872 150 /* Backward jump with uninit is allowed starting with JDK 8 */
hseigel@6872 151 new Case("case15", "stackMapTable.cpp", false, "check_new_object",
kamg@3992 152 "backward jump with uninit",
kamg@3992 153 "Uninitialized object exists on backward branch "),
kamg@3992 154
kamg@3992 155 /* Unreachable: wide instructions verified during bytecode analysis */
kamg@3992 156 new Case("case16", "verifier.cpp", false, "loop header",
kamg@3992 157 "bad op in wide instruction",
kamg@3992 158 "Bad wide instruction"),
kamg@3992 159
kamg@3992 160 new Case("case17", "verifier.cpp", true, "case iaload",
kamg@3992 161 "TOS not X array",
kamg@3992 162 "Bad type on operand stack in iaload"),
kamg@3992 163
kamg@3992 164 new Case("case18", "verifier.cpp", true, "case baload",
kamg@3992 165 "TOS not X array",
kamg@3992 166 "Bad type on operand stack in baload"),
kamg@3992 167
kamg@3992 168 new Case("case19", "verifier.cpp", true, "case caload",
kamg@3992 169 "TOS not X array",
kamg@3992 170 "Bad type on operand stack in caload"),
kamg@3992 171
kamg@3992 172 new Case("case20", "verifier.cpp", true, "case saload",
kamg@3992 173 "TOS not X array",
kamg@3992 174 "Bad type on operand stack in saload"),
kamg@3992 175
kamg@3992 176 new Case("case21", "verifier.cpp", true, "case laload",
kamg@3992 177 "TOS not X array",
kamg@3992 178 "Bad type on operand stack in laload"),
kamg@3992 179
kamg@3992 180 new Case("case22", "verifier.cpp", true, "case faload",
kamg@3992 181 "TOS not X array",
kamg@3992 182 "Bad type on operand stack in faload"),
kamg@3992 183
kamg@3992 184 new Case("case23", "verifier.cpp", true, "case daload",
kamg@3992 185 "TOS not X array",
kamg@3992 186 "Bad type on operand stack in daload"),
kamg@3992 187
kamg@3992 188 new Case("case24", "verifier.cpp", true, "case aaload",
kamg@3992 189 "TOS not X array",
kamg@3992 190 "Bad type on operand stack in aaload"),
kamg@3992 191
kamg@3992 192 new Case("case25", "verifier.cpp", true, "case iastore",
kamg@3992 193 "TOS not int array",
kamg@3992 194 "Bad type on operand stack in iastore"),
kamg@3992 195
kamg@3992 196 new Case("case26", "verifier.cpp", true, "case bastore",
kamg@3992 197 "TOS not byte array",
kamg@3992 198 "Bad type on operand stack in bastore"),
kamg@3992 199
kamg@3992 200 new Case("case27", "verifier.cpp", true, "case castore",
kamg@3992 201 "TOS not char array",
kamg@3992 202 "Bad type on operand stack in castore"),
kamg@3992 203
kamg@3992 204 new Case("case28", "verifier.cpp", true, "case sastore",
kamg@3992 205 "TOS not short array",
kamg@3992 206 "Bad type on operand stack in sastore"),
kamg@3992 207
kamg@3992 208 new Case("case29", "verifier.cpp", true, "case lastore",
kamg@3992 209 "TOS not long array",
kamg@3992 210 "Bad type on operand stack in lastore"),
kamg@3992 211
kamg@3992 212 new Case("case30", "verifier.cpp", true, "case fastore",
kamg@3992 213 "TOS not float array",
kamg@3992 214 "Bad type on operand stack in fastore"),
kamg@3992 215
kamg@3992 216 new Case("case31", "verifier.cpp", true, "case dastore",
kamg@3992 217 "TOS not double array",
kamg@3992 218 "Bad type on operand stack in dastore"),
kamg@3992 219
kamg@3992 220 new Case("case32", "verifier.cpp", true, "case aastore",
kamg@3992 221 "TOS not object array",
kamg@3992 222 "Bad type on operand stack in aastore"),
kamg@3992 223
kamg@3992 224 /* Unreachable: In order to hit this case, we would need a
kamg@3992 225 * category2_1st at TOS which is not possible. */
kamg@3992 226 new Case("case33", "verifier.cpp", false, "case pop2",
kamg@3992 227 "TOS is category2_1st (would split)",
kamg@3992 228 "Bad type on operand stack in pop2"),
kamg@3992 229
kamg@3992 230 /* Unreachable: In order to hit this case, we would need a
kamg@3992 231 * category2_1st at stack depth 2 with category_1 on TOS which is not
kamg@3992 232 * possible. */
kamg@3992 233 new Case("case34", "verifier.cpp", false, "case dup_x2",
kamg@3992 234 "TOS-1 is category2_1st (would split)",
kamg@3992 235 "Bad type on operand stack in dup_x2"),
kamg@3992 236
kamg@3992 237 /* Unreachable: In order to hit this case, we would need a
kamg@3992 238 * category2_1st at TOS which is not possible. */
kamg@3992 239 new Case("case35", "verifier.cpp", false, "case dup2",
kamg@3992 240 "TOS-1 is category2_1st (would split)",
kamg@3992 241 "Bad type on operand stack in dup2"),
kamg@3992 242
kamg@3992 243 /* Unreachable: In order to hit this case, we would need a
kamg@3992 244 * category2_1st at TOS which is not possible. */
kamg@3992 245 new Case("case36", "verifier.cpp", false, "case dup2_x1",
kamg@3992 246 "TOS-1 is category2_1st (would split)",
kamg@3992 247 "Bad type on operand stack in dup2_x1"),
kamg@3992 248
kamg@3992 249 /* Unreachable: In order to hit this case, we would need a
kamg@3992 250 * category2_1st at TOS which is not possible. */
kamg@3992 251 new Case("case37", "verifier.cpp", false, "case dup2_x2",
kamg@3992 252 "TOS-1 is category2_1st (would split)",
kamg@3992 253 "Bad type on operand stack in dup2_x2"),
kamg@3992 254
kamg@3992 255 /* Unreachable: In order to hit this case, we would need a
kamg@3992 256 * category2_1st at stack depth 3 with either 2 category_1 or 1
kamg@3992 257 * category_2 on TOS, which is not possible. */
kamg@3992 258 new Case("case38", "verifier.cpp", false, "case dup2_x2",
kamg@3992 259 "TOS-3 is category2_1st (would split)",
kamg@3992 260 "Bad type on operand stack in dup2_x2"),
kamg@3992 261
kamg@3992 262 new Case("case39", "verifier.cpp", true, "case return",
kamg@3992 263 "return type of method is not void",
kamg@3992 264 "Method expects a return value"),
kamg@3992 265
kamg@3992 266 new Case("case40", "verifier.cpp", true, "case return",
kamg@3992 267 "return with uninitialized this ",
kamg@3992 268 "Constructor must call super() or this() before return"),
kamg@3992 269
kamg@3992 270 new Case("case41", "verifier.cpp", true, "case new",
kamg@3992 271 "cp index not a class type",
kamg@3992 272 "Illegal new instruction"),
kamg@3992 273
kamg@3992 274 new Case("case42", "verifier.cpp", true, "case arraylength",
kamg@3992 275 "TOS is not an array",
kamg@3992 276 "Bad type on operand stack in arraylength"),
kamg@3992 277
kamg@3992 278 new Case("case43", "verifier.cpp", true, "case multianewarray",
kamg@3992 279 "CP index does not refer to array type",
kamg@3992 280 "Illegal constant pool index in multianewarray instruction"),
kamg@3992 281
kamg@3992 282 new Case("case44", "verifier.cpp", true, "case multianewarray",
kamg@3992 283 "Bad dimension (<1) or does not match CP signature",
kamg@3992 284 "Illegal dimension in multianewarray instruction: "),
kamg@3992 285
kamg@3992 286 new Case("case45", "verifier.cpp", true, "case default",
kamg@3992 287 "Unrecognized bytecode",
kamg@3992 288 "Bad instruction: "),
kamg@3992 289
kamg@3992 290 new Case("case46", "verifier.cpp", true, "loop end",
kamg@3992 291 "control flow falls off method",
kamg@3992 292 "Control flow falls through code end"),
kamg@3992 293
kamg@3992 294 new Case("case47", "verifier.cpp", true, "generate_code_data",
kamg@3992 295 "illegal bytecode via RawBytecodeStream (breakpoint)",
kamg@3992 296 "Bad instruction"),
kamg@3992 297
kamg@3992 298 new Case("case48", "verifier.cpp", true, "generate_code_data",
kamg@3992 299 "illegal bytecode via RawBytecodeStream (other illegal)",
kamg@3992 300 "Bad instruction"),
kamg@3992 301
kamg@3992 302 new Case("case49", "verifier.cpp", true,
kamg@3992 303 "verify_exception_handler_table",
kamg@3992 304 "catch_type is not throwable",
kamg@3992 305 "Catch type is not a subclass of Throwable in " +
kamg@3992 306 "exception handler "),
kamg@3992 307
kamg@3992 308 new Case("case50", "verifier.cpp", true, "verify_stackmap_table",
kamg@3992 309 "missing a stack map frame @ target location (mid table)",
kamg@3992 310 "Expecting a stack map frame"),
kamg@3992 311
kamg@3992 312 new Case("case51", "verifier.cpp", true, "verify_stackmap_table",
kamg@3992 313 "stack map does not match?",
kamg@3992 314 "Instruction type does not match stack map"),
kamg@3992 315
kamg@3992 316 new Case("case52", "verifier.cpp", true, "verify_stackmap_table",
kamg@3992 317 "missing a stack map frame @ target location (end of table)",
kamg@3992 318 "Expecting a stack map frame"),
kamg@3992 319
kamg@3992 320 new Case("case53", "verifier.cpp", true,
kamg@3992 321 "verify_exception_handler_targets",
kamg@3992 322 "stackmap mismatch at exception handler",
kamg@3992 323 "Stack map does not match the one at exception handler "),
kamg@3992 324
kamg@3992 325 new Case("case54", "verifier.cpp", true, "verify_cp_index",
kamg@3992 326 "constant pool index is out-of-bounds",
kamg@3992 327 "Illegal constant pool index "),
kamg@3992 328
kamg@3992 329 new Case("case55", "verifier.cpp", true, "verify_cp_type",
kamg@3992 330 "constant pool entry is not expected type",
kamg@3992 331 "Illegal type at constant pool entry "),
kamg@3992 332
kamg@3992 333 new Case("case56", "verifier.cpp", true, "verify_cp_class_type",
kamg@3992 334 "constant pool entry is not an object type",
kamg@3992 335 "Illegal type at constant pool entry "),
kamg@3992 336
kamg@3992 337 /* Unreachable: verify_cp_type gates this case */
kamg@3992 338 new Case("case57", "verifier.cpp", false, "verify_ldc",
kamg@3992 339 "invalid constant pool index in ldc",
kamg@3992 340 "Invalid index in ldc"),
kamg@3992 341
hseigel@4838 342 /* No longer a valid test case for bytecode version >= 51. Nonzero
hseigel@4838 343 * padding bytes are permitted with lookupswitch and tableswitch
hseigel@4838 344 * bytecodes as of JVMS 3d edition */
hseigel@4838 345 new Case("case58", "verifier.cpp", false, "verify_switch",
kamg@3992 346 "bad switch padding",
hseigel@4838 347 "Nonzero padding byte in lookupswitch or tableswitch"),
kamg@3992 348
kamg@3992 349 new Case("case59", "verifier.cpp", true, "verify_switch",
kamg@3992 350 "tableswitch low is greater than high",
kamg@3992 351 "low must be less than or equal to high in tableswitch"),
kamg@3992 352
kamg@3992 353 /* Unreachable on 64-bit? Only way to get here is to overflow
kamg@3992 354 * the 'keys' variable which can't happen on 64-bit since we're dealing
kamg@3992 355 * with 32-bit values. Perhaps reachable on 32-bit but the
kamg@3992 356 * triggering class would be quite large */
kamg@3992 357 new Case("case60", "verifier.cpp", false, "verify_switch",
kamg@3992 358 "high - low + 1 < 0 (overflow?)",
kamg@3992 359 "too many keys in tableswitch"),
kamg@3992 360
kamg@3992 361 /* Would have to create a 16G classfile to trip this. Possible but
kamg@3992 362 * not reasonable to do in a test. */
kamg@3992 363 new Case("case61", "verifier.cpp", false, "verify_switch",
kamg@3992 364 "lookupswitch keys < 0",
kamg@3992 365 "number of keys in lookupswitch less than 0"),
kamg@3992 366
kamg@3992 367 new Case("case62", "verifier.cpp", true, "verify_switch",
kamg@3992 368 "lookupswitch keys out-of-order",
kamg@3992 369 "Bad lookupswitch instruction"),
kamg@3992 370
kamg@3992 371 /* Unreachable: Class file parser verifies Fieldref contents */
kamg@3992 372 new Case("case63", "verifier.cpp", false, "verify_field_instructions",
kamg@3992 373 "referenced class is not an CP object",
kamg@3992 374 "Expecting reference to class in class "),
kamg@3992 375
kamg@3992 376 new Case("case64", "verifier.cpp", true, "verify_field_instructions",
kamg@3992 377 "TOS not assignable to field type in putfield",
kamg@3992 378 "Bad type on operand stack in putfield"),
kamg@3992 379
kamg@3992 380 new Case("case65", "verifier.cpp", true, "verify_field_instructions",
kamg@3992 381 "TOS not assignable to class when accessing protected field",
kamg@3992 382 "Bad access to protected data in getfield"),
kamg@3992 383
kamg@3992 384 new Case("case66", "verifier.cpp", true, "verify_invoke_init",
kamg@3992 385 "Uninit_this is not of the current type or it's supertype",
kamg@3992 386 "Bad <init> method call"),
kamg@3992 387
kamg@3992 388 /* Unreachable: Stack map parsing ensures valid type and new
kamg@3992 389 * instructions have a valid BCI. */
kamg@3992 390 new Case("case67", "verifier.cpp", false, "verify_invoke_init",
kamg@3992 391 "Uninit type with bad new instruction index",
kamg@3992 392 "Expecting new instruction"),
kamg@3992 393
kamg@3992 394 new Case("case68", "verifier.cpp", true, "verify_invoke_init",
kamg@3992 395 "calling other class's <init> method",
kamg@3992 396 "Call to wrong <init> method"),
kamg@3992 397
kamg@3992 398 new Case("case69", "verifier.cpp", true, "verify_invoke_init",
kamg@3992 399 "Calling protected <init> and type unassignable from current",
kamg@3992 400 "Bad access to protected <init> method"),
kamg@3992 401
kamg@3992 402 new Case("case70", "verifier.cpp", true, "verify_invoke_init",
kamg@3992 403 "TOS is not an uninitialized (or Uninit_this) type",
kamg@3992 404 "Bad operand type when invoking <init>"),
kamg@3992 405
kamg@3992 406 new Case("case71", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 407 "Arg count in instruction doesn't match signature",
kamg@3992 408 "Inconsistent args count operand in invokeinterface"),
kamg@3992 409
kamg@3992 410 new Case("case72", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 411 "Non-zero pad in invokeinterface",
kamg@3992 412 "Fourth operand byte of invokeinterface must be zero"),
kamg@3992 413
kamg@3992 414 new Case("case73", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 415 "Non-zero pad in invokedynamic",
kamg@3992 416 "Third and fourth operand bytes of " +
kamg@3992 417 "invokedynamic must be zero"),
kamg@3992 418
kamg@3992 419 new Case("case74", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 420 "Non-invokespecial trying to invoke a '<' method",
kamg@3992 421 "Illegal call to internal method"),
kamg@3992 422
kamg@3992 423 new Case("case75", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 424 "invokespecial and current unassignable from referenced type",
kamg@3992 425 "Bad invokespecial instruction: current class isn't " +
kamg@3992 426 "assignable to reference class."),
kamg@3992 427
kamg@3992 428 new Case("case76", "verifier.cpp", true, "verify_invoke_instructions",
kamg@3992 429 "TOS not assignable to current when calling protected method",
kamg@3992 430 "Bad access to protected data in invokevirtual"),
kamg@3992 431
kamg@3992 432 /* Unreachable: class file parser enforces void signature */
kamg@3992 433 new Case("case77", "verifier.cpp", false, "verify_invoke_instructions",
kamg@3992 434 "<init> method is not void return",
kamg@3992 435 "Return type must be void in <init> method"),
kamg@3992 436
kamg@3992 437 new Case("case78", "verifier.cpp", true, "get_newarray_type",
kamg@3992 438 "newarray type invalid",
kamg@3992 439 "Illegal newarray instruction"),
kamg@3992 440
kamg@3992 441 new Case("case79", "verifier.cpp", true, "verify_return_value",
kamg@3992 442 "void return from method which has a return value",
kamg@3992 443 "Method expects a return value"),
kamg@3992 444
kamg@3992 445 new Case("case80", "verifier.cpp", true, "verify_return_value",
kamg@3992 446 "TOS type does not match signature",
kamg@3992 447 "Bad return type"),
kamg@3992 448
kamg@3992 449 new Case("case81", "verifier.cpp", true, "verify_stackmap_table",
kamg@3992 450 "stack map does not match (flags)",
kamg@3992 451 "Instruction type does not match stack map")
kamg@3992 452 };
kamg@3992 453 }
kamg@3992 454
kamg@3992 455 public class Test7116786 {
kamg@3992 456 public static void main(String argv[]) throws Exception {
kamg@3992 457 for (Case c : VerifyErrorCases.cases) {
kamg@3992 458 System.out.println("******** " + c.getCaseName() + " ********");
kamg@3992 459 if (c.isTestable()) {
kamg@3992 460 try {
kamg@3992 461 ClassLoader cl = Test7116786.class.getClassLoader();
kamg@3992 462 Class<?> cls = Class.forName(c.getCaseName(), true, cl);
kamg@3992 463 throw new RuntimeException(
kamg@3992 464 "++ FAIL: No verify error encountered");
kamg@3992 465 } catch (VerifyError ve) {
kamg@3992 466 String message = c.getMessage();
kamg@3992 467 String veMessage = ve.getMessage();
kamg@3992 468 System.out.print(veMessage);
kamg@3992 469 if (!veMessage.startsWith(message)) {
kamg@3992 470 // We're not seeing the message we expect. Could be
kamg@3992 471 // that we've gotten the wrong VerifyError case, or
kamg@3992 472 // maybe the message changed.
kamg@3992 473 System.out.println("++ FAIL? " +
kamg@3992 474 "Message does not match what was expected: " +
kamg@3992 475 message);
kamg@3992 476 continue;
kamg@3992 477 }
kamg@3992 478 if (!veMessage.contains("Exception Details:") &&
kamg@3992 479 !veMessage.contains("Reason:")) {
kamg@3992 480 System.out.println("++ FAIL: No details found");
kamg@3992 481 throw new RuntimeException("FAIL: No details found");
kamg@3992 482 }
kamg@3992 483 System.out.println("++ PASS");
kamg@3992 484 }
kamg@3992 485 } else {
kamg@3992 486 System.out.println("++ SKIPPED");
kamg@3992 487 }
kamg@3992 488 }
kamg@3992 489 }
kamg@3992 490 }

mercurial