"java.lang.VerifyError: Inconsistent stackmap frames" error when running application
We're trying to obfuscate our application (Java 14.0.1, Groovy 3.0.4) using a Gradle task. The configuration is pretty vanilla, mostly using the supplied examples, and completes successfully. However, when trying to run the application after it's been processed, it fails almost immediately with the following error:
Exception in thread "main" java.lang.VerifyError: Inconsistent stackmap frames at branch target 152
Exception Details:
Location:
com/application/view/AdminView.<init>()V @152: new
Reason:
Type uninitializedThis (current frame, stack[1]) is not assignable to 'com/application/view/AdminView' (stack map, stack[1])
Current Frame:
bci: @27
flags: { flagThisUninit }
locals: { uninitializedThis, '[Lorg/codehaus/groovy/runtime/callsite/CallSite;' }
stack: { '[Ljava/lang/Object;', uninitializedThis, integer }
Stackmap Frame:
bci: @152
flags: { }
locals: { }
stack: { '[Ljava/lang/Object;', 'com/application/view/AdminView' }
Any suggestions where we should be looking when trying to fix this?
The JVM rejects the computed preverification attribute ("StackMapTable"). Make sure you don't have -dontpreverify in your ProGuard configuration.
Also make sure you don't have -dontwarn or -ignorewarnings in your configuration. ProGuard needs all class hierarchies to correctly perform preverification.
Otherwise, this may be a bug in ProGuard. Is AdminView perhaps written in Groovy, so it may have a less common structure? Can you share the binary com/application/view/AdminView.class, right before and right after ProGuard has processed it?
If it is a bug in ProGuard, you see if -keep,includecode class com.application.view.AdminView { void <init>(); } or -optimizationpasses 1 or even -dontoptimize makes a difference.
I'm not using any of the flags mentioned, and I did try adding the -dontoptimize flag with the same results. I have attached a zip file that contains the original groovy file (which is a 'yes' to that question), the 2 versions of the decompiled class file, and also the gradle file for reference. AdminView.zip
@EricLafortune have you had the chance to look at the files that I uploaded? Just wondering if you have any ideas about a possible resolution.