Skip to content

Instantly share code, notes, and snippets.

@freakboy3742
Created August 18, 2016 14:04
Show Gist options
  • Save freakboy3742/722ba1cffffbcf040da0eeb735ab0201 to your computer and use it in GitHub Desktop.
Save freakboy3742/722ba1cffffbcf040da0eeb735ab0201 to your computer and use it in GitHub Desktop.
VerifyError?
Classfile /Users/rkm/projects/beeware/voc/freakboy3742/local/python/example/__init__.class
Last modified 18/08/2016; size 1800 bytes
MD5 checksum e44b3a6ceba29f2b73e0357a7b40f7ed
Compiled from "example.py"
public class python.example.__init__ extends org.python.types.Module
SourceFile: "example.py"
minor version: 0
major version: 50
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Class #2 // python/example/__init__
#2 = Utf8 python/example/__init__
#3 = Class #4 // org/python/types/Module
#4 = Utf8 org/python/types/Module
#5 = Utf8 module$import
#6 = Utf8 ()V
#7 = Utf8 Code
#8 = Class #9 // org/python/types/List
#9 = Utf8 org/python/types/List
#10 = Class #11 // java/util/ArrayList
#11 = Utf8 java/util/ArrayList
#12 = Methodref #10.#13 // java/util/ArrayList."<init>":(I)V
#13 = NameAndType #14:#15 // "<init>":(I)V
#14 = Utf8 <init>
#15 = Utf8 (I)V
#16 = Class #17 // org/python/types/Int
#17 = Utf8 org/python/types/Int
#18 = Methodref #16.#19 // org/python/types/Int."<init>":(J)V
#19 = NameAndType #14:#20 // "<init>":(J)V
#20 = Utf8 (J)V
#21 = InterfaceMethodref #22.#24 // java/util/List.add:(Ljava/lang/Object;)Z
#22 = Class #23 // java/util/List
#23 = Utf8 java/util/List
#24 = NameAndType #25:#26 // add:(Ljava/lang/Object;)Z
#25 = Utf8 add
#26 = Utf8 (Ljava/lang/Object;)Z
#27 = Long 2l
#29 = Methodref #8.#30 // org/python/types/List."<init>":(Ljava/util/List;)V
#30 = NameAndType #14:#31 // "<init>":(Ljava/util/List;)V
#31 = Utf8 (Ljava/util/List;)V
#32 = Fieldref #33.#35 // python/sys/__init__.modules:Lorg/python/types/Dict;
#33 = Class #34 // python/sys/__init__
#34 = Utf8 python/sys/__init__
#35 = NameAndType #36:#37 // modules:Lorg/python/types/Dict;
#36 = Utf8 modules
#37 = Utf8 Lorg/python/types/Dict;
#38 = Class #39 // org/python/types/Str
#39 = Utf8 org/python/types/Str
#40 = String #41 // example
#41 = Utf8 example
#42 = Methodref #38.#43 // org/python/types/Str."<init>":(Ljava/lang/String;)V
#43 = NameAndType #14:#44 // "<init>":(Ljava/lang/String;)V
#44 = Utf8 (Ljava/lang/String;)V
#45 = InterfaceMethodref #46.#48 // org/python/Object.__getitem__:(Lorg/python/Object;)Lorg/python/Object;
#46 = Class #47 // org/python/Object
#47 = Utf8 org/python/Object
#48 = NameAndType #49:#50 // __getitem__:(Lorg/python/Object;)Lorg/python/Object;
#49 = Utf8 __getitem__
#50 = Utf8 (Lorg/python/Object;)Lorg/python/Object;
#51 = String #52 // x
#52 = Utf8 x
#53 = InterfaceMethodref #46.#54 // org/python/Object.__setattr__:(Ljava/lang/String;Lorg/python/Object;)V
#54 = NameAndType #55:#56 // __setattr__:(Ljava/lang/String;Lorg/python/Object;)V
#55 = Utf8 __setattr__
#56 = Utf8 (Ljava/lang/String;Lorg/python/Object;)V
#57 = Methodref #8.#58 // org/python/types/List."<init>":()V
#58 = NameAndType #14:#6 // "<init>":()V
#59 = InterfaceMethodref #46.#60 // org/python/Object.__getattribute__:(Ljava/lang/String;)Lorg/python/Object;
#60 = NameAndType #61:#62 // __getattribute__:(Ljava/lang/String;)Lorg/python/Object;
#61 = Utf8 __getattribute__
#62 = Utf8 (Ljava/lang/String;)Lorg/python/Object;
#63 = InterfaceMethodref #46.#64 // org/python/Object.__iter__:()Lorg/python/Iterable;
#64 = NameAndType #65:#66 // __iter__:()Lorg/python/Iterable;
#65 = Utf8 __iter__
#66 = Utf8 ()Lorg/python/Iterable;
#67 = Class #68 // org/python/Iterable
#68 = Utf8 org/python/Iterable
#69 = InterfaceMethodref #67.#70 // org/python/Iterable.__next__:()Lorg/python/Object;
#70 = NameAndType #71:#72 // __next__:()Lorg/python/Object;
#71 = Utf8 __next__
#72 = Utf8 ()Lorg/python/Object;
#73 = String #74 // v
#74 = Utf8 v
#75 = Methodref #8.#76 // org/python/types/List.append:(Lorg/python/Object;)Lorg/python/Object;
#76 = NameAndType #77:#50 // append:(Lorg/python/Object;)Lorg/python/Object;
#77 = Utf8 append
#78 = Class #79 // java/util/HashMap
#79 = Utf8 java/util/HashMap
#80 = Methodref #78.#58 // java/util/HashMap."<init>":()V
#81 = String #82 // print
#82 = Utf8 print
#83 = Class #84 // org/python/Callable
#84 = Utf8 org/python/Callable
#85 = InterfaceMethodref #83.#86 // org/python/Callable.invoke:([Lorg/python/Object;Ljava/util/Map;)Lorg/python/Object;
#86 = NameAndType #87:#88 // invoke:([Lorg/python/Object;Ljava/util/Map;)Lorg/python/Object;
#87 = Utf8 invoke
#88 = Utf8 ([Lorg/python/Object;Ljava/util/Map;)Lorg/python/Object;
#89 = Utf8 LineNumberTable
#90 = Class #91 // org/python/exceptions/StopIteration
#91 = Utf8 org/python/exceptions/StopIteration
#92 = Methodref #3.#58 // org/python/types/Module."<init>":()V
#93 = Utf8 main
#94 = Utf8 ([Ljava/lang/String;)V
#95 = Methodref #1.#58 // python/example/__init__."<init>":()V
#96 = InterfaceMethodref #46.#97 // org/python/Object.__setitem__:(Lorg/python/Object;Lorg/python/Object;)V
#97 = NameAndType #98:#99 // __setitem__:(Lorg/python/Object;Lorg/python/Object;)V
#98 = Utf8 __setitem__
#99 = Utf8 (Lorg/python/Object;Lorg/python/Object;)V
#100 = String #101 // __main__
#101 = Utf8 __main__
#102 = Methodref #1.#103 // python/example/__init__.module$import:()V
#103 = NameAndType #5:#6 // module$import:()V
#104 = Fieldref #105.#107 // org/python/exceptions/SystemExit.return_code:I
#105 = Class #106 // org/python/exceptions/SystemExit
#106 = Utf8 org/python/exceptions/SystemExit
#107 = NameAndType #108:#109 // return_code:I
#108 = Utf8 return_code
#109 = Utf8 I
#110 = Methodref #111.#113 // java/lang/System.exit:(I)V
#111 = Class #112 // java/lang/System
#112 = Utf8 java/lang/System
#113 = NameAndType #114:#15 // exit:(I)V
#114 = Utf8 exit
#115 = Utf8 SourceFile
#116 = Utf8 example.py
{
public void module$import();
Signature: ()V
flags: ACC_PUBLIC
LineNumberTable:
line 1: 9
line 2: 87
Code:
stack=15, locals=5, args_size=1
0: aconst_null
1: astore_1
2: aconst_null
3: astore_2
4: aconst_null
5: astore_3
6: aconst_null
7: astore 4
9: new #8 // class org/python/types/List
12: dup
13: new #10 // class java/util/ArrayList
16: dup
17: iconst_2
18: invokespecial #12 // Method java/util/ArrayList."<init>":(I)V
21: dup
22: new #16 // class org/python/types/Int
25: dup
26: lconst_1
27: invokespecial #18 // Method org/python/types/Int."<init>":(J)V
30: invokeinterface #21, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
35: pop
36: dup
37: new #16 // class org/python/types/Int
40: dup
41: ldc2_w #27 // long 2l
44: invokespecial #18 // Method org/python/types/Int."<init>":(J)V
47: invokeinterface #21, 2 // InterfaceMethod java/util/List.add:(Ljava/lang/Object;)Z
52: pop
53: invokespecial #29 // Method org/python/types/List."<init>":(Ljava/util/List;)V
56: astore_1
57: getstatic #32 // Field python/sys/__init__.modules:Lorg/python/types/Dict;
60: new #38 // class org/python/types/Str
63: dup
64: ldc_w #40 // String example
67: invokespecial #42 // Method org/python/types/Str."<init>":(Ljava/lang/String;)V
70: invokeinterface #45, 2 // InterfaceMethod org/python/Object.__getitem__:(Lorg/python/Object;)Lorg/python/Object;
75: checkcast #3 // class org/python/types/Module
78: ldc_w #51 // String x
81: aload_1
82: invokeinterface #53, 3 // InterfaceMethod org/python/Object.__setattr__:(Ljava/lang/String;Lorg/python/Object;)V
87: iconst_1
88: anewarray #46 // class org/python/Object
91: astore_1
92: new #8 // class org/python/types/List
95: dup
96: invokespecial #57 // Method org/python/types/List."<init>":()V
99: astore_2
100: getstatic #32 // Field python/sys/__init__.modules:Lorg/python/types/Dict;
103: new #38 // class org/python/types/Str
106: dup
107: ldc_w #40 // String example
110: invokespecial #42 // Method org/python/types/Str."<init>":(Ljava/lang/String;)V
113: invokeinterface #45, 2 // InterfaceMethod org/python/Object.__getitem__:(Lorg/python/Object;)Lorg/python/Object;
118: checkcast #3 // class org/python/types/Module
121: ldc_w #51 // String x
124: invokeinterface #59, 2 // InterfaceMethod org/python/Object.__getattribute__:(Ljava/lang/String;)Lorg/python/Object;
129: invokeinterface #63, 1 // InterfaceMethod org/python/Object.__iter__:()Lorg/python/Iterable;
134: astore_3
135: aload_3
136: checkcast #67 // class org/python/Iterable
139: invokeinterface #69, 1 // InterfaceMethod org/python/Iterable.__next__:()Lorg/python/Object;
144: goto 151
147: pop
148: goto 222
151: astore 4
153: getstatic #32 // Field python/sys/__init__.modules:Lorg/python/types/Dict;
156: new #38 // class org/python/types/Str
159: dup
160: ldc_w #40 // String example
163: invokespecial #42 // Method org/python/types/Str."<init>":(Ljava/lang/String;)V
166: invokeinterface #45, 2 // InterfaceMethod org/python/Object.__getitem__:(Lorg/python/Object;)Lorg/python/Object;
171: checkcast #3 // class org/python/types/Module
174: ldc_w #73 // String v
177: aload 4
179: invokeinterface #53, 3 // InterfaceMethod org/python/Object.__setattr__:(Ljava/lang/String;Lorg/python/Object;)V
184: getstatic #32 // Field python/sys/__init__.modules:Lorg/python/types/Dict;
187: new #38 // class org/python/types/Str
190: dup
191: ldc_w #40 // String example
194: invokespecial #42 // Method org/python/types/Str."<init>":(Ljava/lang/String;)V
197: invokeinterface #45, 2 // InterfaceMethod org/python/Object.__getitem__:(Lorg/python/Object;)Lorg/python/Object;
202: checkcast #3 // class org/python/types/Module
205: ldc_w #73 // String v
208: invokeinterface #59, 2 // InterfaceMethod org/python/Object.__getattribute__:(Ljava/lang/String;)Lorg/python/Object;
213: aload_2
214: swap
215: invokespecial #75 // Method org/python/types/List.append:(Lorg/python/Object;)Lorg/python/Object;
218: pop
219: goto 135
222: aload_2
223: aload_1
224: swap
225: iconst_0
226: swap
227: aastore
228: new #78 // class java/util/HashMap
231: dup
232: invokespecial #80 // Method java/util/HashMap."<init>":()V
235: astore_3
236: getstatic #32 // Field python/sys/__init__.modules:Lorg/python/types/Dict;
239: new #38 // class org/python/types/Str
242: dup
243: ldc_w #40 // String example
246: invokespecial #42 // Method org/python/types/Str."<init>":(Ljava/lang/String;)V
249: invokeinterface #45, 2 // InterfaceMethod org/python/Object.__getitem__:(Lorg/python/Object;)Lorg/python/Object;
254: checkcast #3 // class org/python/types/Module
257: ldc_w #81 // String print
260: invokeinterface #59, 2 // InterfaceMethod org/python/Object.__getattribute__:(Ljava/lang/String;)Lorg/python/Object;
265: checkcast #83 // class org/python/Callable
268: aload_1
269: aload_3
270: invokeinterface #85, 3 // InterfaceMethod org/python/Callable.invoke:([Lorg/python/Object;Ljava/util/Map;)Lorg/python/Object;
275: pop
276: return
Exception table:
from to target type
135 144 147 Class org/python/exceptions/StopIteration
LineNumberTable:
line 1: 9
line 2: 87
public python.example.__init__();
Signature: ()V
flags: ACC_PUBLIC
Code:
stack=2, locals=1, args_size=1
0: aload_0
1: dup
2: invokespecial #92 // Method org/python/types/Module."<init>":()V
5: return
public static void main(java.lang.String[]);
Signature: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC
LineNumberTable:
Code:
stack=8, locals=2, args_size=1
0: aconst_null
1: astore_1
2: getstatic #32 // Field python/sys/__init__.modules:Lorg/python/types/Dict;
5: dup
6: new #38 // class org/python/types/Str
9: dup
10: ldc_w #40 // String example
13: invokespecial #42 // Method org/python/types/Str."<init>":(Ljava/lang/String;)V
16: new #1 // class python/example/__init__
19: dup
20: dup
21: invokespecial #95 // Method "<init>":()V
24: astore_1
25: invokeinterface #96, 3 // InterfaceMethod org/python/Object.__setitem__:(Lorg/python/Object;Lorg/python/Object;)V
30: new #38 // class org/python/types/Str
33: dup
34: ldc_w #100 // String __main__
37: invokespecial #42 // Method org/python/types/Str."<init>":(Ljava/lang/String;)V
40: aload_1
41: invokeinterface #96, 3 // InterfaceMethod org/python/Object.__setitem__:(Lorg/python/Object;Lorg/python/Object;)V
46: aload_1
47: invokevirtual #102 // Method module$import:()V
50: goto 59
53: getfield #104 // Field org/python/exceptions/SystemExit.return_code:I
56: invokestatic #110 // Method java/lang/System.exit:(I)V
59: return
Exception table:
from to target type
2 50 53 Class org/python/exceptions/SystemExit
LineNumberTable:
}
Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 53
Exception Details:
Location:
python/example/__init__.main([Ljava/lang/String;)V @2: getstatic
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: 014c b200 2059 bb00 2659 1300 28b7 002a
0000010: bb00 0159 59b7 005f 4cb9 0060 0300 bb00
0000020: 2659 1300 64b7 002a 2bb9 0060 0300 2bb6
0000030: 0066 a700 09b4 0068 b800 6eb1
Exception Handler Table:
bci [2, 50] => handler: 53
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
at java.lang.Class.getMethod0(Class.java:2813)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
@freakboy3742
Copy link
Author

Problem resolved - it was this line. It should be invokevirtual not invokespecial; if you turn off verification, it still works, but for some reason, it manifests as a completely unhelpful verification error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment