Java 7 JVM VerifyError in Eclipse

mre picture mre · Nov 1, 2011 · Viewed 27.2k times · Source

When I compile my project in eclipse indigo using JDK 7, I get the following error dialog

enter image description here

with the following stacktrace

Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 32 in method ... at offset 0
    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've found a relevant bug here and used the suggested workaround of using jvm option -XX:-UseSplitVerifier and although it works, this bug still confuses me.

Does anyone know why this is happening and why the workaround...works?

--Note--

The project compiles fine using JDK 6.

Answer

VonC picture VonC · Nov 1, 2011

Bug 353467 speaks about "using -XX:-UseSplitVerifier to activate the old verifier".
That is consistent with the JDK TM 6 Adoption Guide which describes that option as:

Traditional verifier can be forced with the -XX:-UseSplitVerifier flag.

Missing or incorrect StackMapTable attributes for version 50.0 class files can result in VerifyError exceptions.
Tools that rewrite bytecode in version 50.0 class files and do not correctly update the StackMapTable may fail to verify and trigger exceptions.

So the comment from 2011-10-03 does point out that:

AspectJ now auto activates the previously optional setting to create stackmaps if the classes are Java7.