Confusion causes verifyerror: expect a stack diagram frame
We are using the latest JDK 7 (U45) and Proguard version 4.10
Recently, our distribution failed. After confusion, the following error occurred:
Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 155 Exception Details: Location: com/bla/bla/service/ioc/SpringBootstrap.c()V @0: getstatic Reason: Expected stackmap frame at this location. Bytecode: 0000000: b200 73b6 008b 9900 82b2 0073 b800 933b 0000010: 1a99 0074 b200 73b6 008d 9900 6bb2 0074 0000020: 1221 b600 cfb8 0092 4c2b b600 9c12 1db9 ... Exception Handler Table: bci [0,152] => handler: 155 at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(UnkNown Source) at java.lang.Class.getmethod0(UnkNown Source) at java.lang.Class.getmethod(UnkNown Source) at sun.launcher.LauncherHelper.getMainMethod(UnkNown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(UnkNown Source)
I found several discussions on this topic on stackoverflow, such as
> java-lang-verifyerror-expecting-a-stackmap-frame-at-branch-target-jdk-1-7 > java-lang-verifyerror-expecting-a-stackmap-frame > understanding-how-to-resolve-inconsistent-stackmap-frames-exception > java-7-inconsistent-stackmap-frames-need-help-understanding-why-solution-wor
What I understand is that Java 7 uses stricter validation and introduces stack mapping for class validation code So during my confusion, the map seems to have been destroyed, because only this exception occurs when I blur my project with Proguard
Using - XX to disable validation: - useplitverifier and start the built jar is helpful, but I'm not sure whether it should be the way to deal with this problem
So I wonder if anyone else has a simulation error? Or if someone can even know a specific method to solve this problem, for example, by adjusting the Proguard konfiguration of the confusion process?
Solution
I assume you didn't specify - dontprevify? This option almost certainly causes these errors because it stops Proguard from updating the stackmaptable property This attribute is optional in Java 6, but required in Java 7
You can still try the beta version of Proguard 4.11, but it's unlikely to make a difference here If you mail the documents I handle, I'll study them
(I'm a developer of Proguard)