How can I overcome VerifyError: Expecting framemap frame for the JDK 7/8 application?

I am using ASM 5.0.3 bytecode modification library with Tomcat 8 and JDK 8.

My intention is to successfully implement bytecode in all classes. However, I encountered the following error:

java.lang.VerifyError: Expecting a stackmap frame at branch target 18
Exception Details:
  Location:
    com/sun/crypto/provider/SunJCE.getInstance()Lcom/sun/crypto/provider/SunJCE; @0: getstatic
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0x0000000: b200 0bc7 000b bb00 3659 b700 0cb0 b200
    0x0000010: 0bb0 bf                                
  Exception Handler Table:
    bci [0, 18] => handler: 18
  Stackmap Table:
    append_frame(@14,Integer)

            at java.lang.Class.getDeclaredConstructors0(Native Method)
            at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
            at java.lang.Class.getConstructor0(Unknown Source)
            at java.lang.Class.newInstance(Unknown Source)
            at sun.security.jca.ProviderConfig$2.run(Unknown Source)
            at sun.security.jca.ProviderConfig$2.run(Unknown Source)
           ......Some more uninteresting lines in the stack trace.......
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
            at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)

The key parts of the code that I used to call the ASM methods are the following:

ClassWriter classWriter = new  ClassWriter(classReader, ClassWriter.COMPUTE_MAXS);

classReader.accept(myClassVisitor, ClassReader.EXPAND_FRAMES);

The code above works fine with modifying the bytecode of the JDK 6 application. The error is displayed only for JDK 7 and JDK 8 applications.

stackoverflow -XX: -UseSplitVerifier -noverify flags. , , -XX: -UseSplitVerifier JDK 8. , , Java.

.

: COMPUTE_FRAMES COMPUTE_MAXS, ASM - java.lang.VerifyError: Exception COMPUTE_FRAMES. JDK 7/8 COMPUTE_MAXS COMPUTE_FRAMES.

+2
2

, ClassWriter getCommonSuperClass.

, ASM 5.0.3. maxStack Java 1.8 Java.lang.VerifyError:

+1

ClassWriter#COMPUTE_FRAMES . - typechecker ( ) JDK 7 , JDK 6.

, ( COMPUTE_FRAMES JavaDoc):

computeFrames computeMaxs

+3

Source: https://habr.com/ru/post/1656215/


All Articles