ASM 9.2 generated class gives error java.lang.VerifyError: Instruction type does not match stack map
I am having some older classes saving them in bytearray. When i use below code
ClassReader classReader=new ClassReader(inputBytes);
ClassWriter cw=new ClassWriter(ClassWriter.COMPUTE_FRAMES );
classReader.accept(cw, ClassReader.SKIP_FRAMES);
outputBytes = new byte[cw.toByteArray().length];
Generated class gives following error "java.lang.VerifyError: Instruction type does not match stack map" at run time of new class. Java class is of JDK 9.0 compiled and using ASM-9.2.jar for converting same.
Exception in thread "BounceThread" java.lang.VerifyError: Instruction type does not match stack map
Exception Details:
Location:
V11ViwS8wSQTF82U.KXQ0oXZUdpY0ZA5R(Lcom/bounce/BouncePanel$BounceThread;)V @2: aload_0
Reason:
Type 'com/bounce/BouncePanel$BounceThread' (current frame, locals[0]) is not assignable to 'V11ViwS8wSQTF82U' (stack map,
locals[0])
Current Frame:
bci: @2
flags: { }
locals: { 'com/bounce/BouncePanel$BounceThread', 'com/bounce/BouncePanel$BounceThread' }
stack: { }
Stackmap Frame:
bci: @2
flags: { }
locals: { 'V11ViwS8wSQTF82U' }
stack: { }
Bytecode:
0000000: 2b4b 2ab4 000c b800 103c 2ab4 000c b800
0000010: 133d 2ab4 000c b800 171c b800 1b2a b400
0000020: 0cb8 001e 1b1c b800 222a b400 0cb8 0025
0000030: b800 292a b400 0cb8 002d 1400 2eb8 0035
0000040: a700 044e a7ff be
Exception Handler Table:
bci [58, 64] => handler: 67
Stackmap Table:
chop_frame(@2,1)
full_frame(@67,{Top,Integer,Integer},{Object[#8]})
same_frame(@68)
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
at java.base/java.lang.Class.getConstructor0(Class.java:3578)
at java.base/java.lang.Class.newInstance(Class.java:626)
at com.bounce.BouncePanel$BounceThread.run(Bounce.java)
at java.base/java.lang.Thread.run(Thread.java:833)
I am calling above code from JNI (from C). It seems that i have missed something.
Please help.