|
| 1 | +/* |
| 2 | + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | + * |
| 5 | + * This code is free software; you can redistribute it and/or modify it |
| 6 | + * under the terms of the GNU General Public License version 2 only, as |
| 7 | + * published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | + * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | + * accompanied this code). |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License version |
| 16 | + * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | + * |
| 19 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | + * or visit www.oracle.com if you need additional information or have any |
| 21 | + * questions. |
| 22 | + * |
| 23 | + */ |
| 24 | + |
| 25 | +class BadLookupSwitch { |
| 26 | + 0xCAFEBABE; |
| 27 | + 0; |
| 28 | + 50; |
| 29 | + [] { // Constant Pool |
| 30 | + ; // first element is empty |
| 31 | + class #12; // #1 at 0x0A |
| 32 | + class #15; // #2 at 0x0D |
| 33 | + Method #2 #4; // #3 at 0x10 |
| 34 | + NameAndType #6 #5; // #4 at 0x15 |
| 35 | + Utf8 "()V"; // #5 at 0x1A |
| 36 | + Utf8 "<init>"; // #6 at 0x20 |
| 37 | + Utf8 "Code"; // #7 at 0x29 |
| 38 | + Utf8 "ConstantValue"; // #8 at 0x30 |
| 39 | + Utf8 "Exceptions"; // #9 at 0x40 |
| 40 | + Utf8 "LineNumberTable"; // #10 at 0x4D |
| 41 | + Utf8 "LocalVariables"; // #11 at 0x5F |
| 42 | + Utf8 "BadLookupSwitch"; // #12 at 0x70 |
| 43 | + Utf8 "SourceFile"; // #13 at 0x76 |
| 44 | + Utf8 "f.java"; // #14 at 0x83 |
| 45 | + Utf8 "java/lang/Object"; // #15 at 0x8C |
| 46 | + Utf8 "m"; // #16 at 0x9F |
| 47 | + Utf8 "StackMapTable"; // #17 |
| 48 | + } // Constant Pool |
| 49 | + |
| 50 | + 0x0020; // access |
| 51 | + #1;// this_cpx |
| 52 | + #2;// super_cpx |
| 53 | + |
| 54 | + [0] { // Interfaces |
| 55 | + } // Interfaces |
| 56 | + |
| 57 | + [0] { // fields |
| 58 | + } // fields |
| 59 | + |
| 60 | + [2] { // methods |
| 61 | + { // Member at 0xAF |
| 62 | + 0x0001; // access |
| 63 | + #16; // name_cpx |
| 64 | + #5; // sig_cpx |
| 65 | + [] { // Attributes |
| 66 | + Attr(#7) { // Code at 0xB7 |
| 67 | + 1; // max_stack |
| 68 | + 1; // max_locals |
| 69 | + Bytes[29] { |
| 70 | + 0x04AB00000000001B; // iconst_1; |
| 71 | +/* right: |
| 72 | + 0x0000000200000001; // lookupswitch 27 2 1 27 2 27; |
| 73 | + 0x0000001B00000002; |
| 74 | + 0x0000001B; |
| 75 | +end right */ |
| 76 | +// wrong: |
| 77 | + 0x0000000200000002; // lookupswitch 27 2 2 27 1 27; |
| 78 | + 0x0000001B00000001; |
| 79 | + 0x0000001B; |
| 80 | +// end wrong |
| 81 | + 0xB1; // return |
| 82 | + }; |
| 83 | + [0] { // Traps |
| 84 | + } // end Traps |
| 85 | + [] { // Attributes |
| 86 | + Attr(#17) { // StackMap |
| 87 | + [] { // |
| 88 | + 255b, 28, []{O,1}, []{}; |
| 89 | + } |
| 90 | + } // end StackMap |
| 91 | + } // Attributes |
| 92 | + } // end Code |
| 93 | + } // Attributes |
| 94 | + } // Member |
| 95 | + ; |
| 96 | + { // Member at 0xD6 |
| 97 | + 0x0000; // access |
| 98 | + #6; // name_cpx |
| 99 | + #5; // sig_cpx |
| 100 | + [1] { // Attributes |
| 101 | + Attr(#7) { // Code at 0xDE |
| 102 | + 1; // max_stack |
| 103 | + 1; // max_locals |
| 104 | + Bytes[5] { |
| 105 | + 0x2AB70003B1; |
| 106 | + }; |
| 107 | + [0] { // Traps |
| 108 | + } // end Traps |
| 109 | + [] { // Attributes |
| 110 | + } // Attributes |
| 111 | + } // end Code |
| 112 | + } // Attributes |
| 113 | + } // Member |
| 114 | + } // methods |
| 115 | + |
| 116 | + [] { // Attributes |
| 117 | + } // Attributes |
| 118 | +} // end class |
0 commit comments