VerifyError Expecting a stackmap frame

I’ve just added a couple of new projects to my Hudson CI system and I noticed that one of the projects, which was configured to build with Java 7, had every test fail with an exception. I decided to use Java 7 after I’d already started working on the project so Java 7 features were only used in the tests at this point so my guess was a problem with the JVM.

The exact problem I was suffering was this:

java.lang.VerifyError: Expecting a stackmap frame at branch target 213 in 
method c.s.i.c.SomeClass.someMethod(Lorg/w3c/dom/Document;)V at offset 6

Not the worlds most helpful error message but generally errors like this in my experience point to something fundamentally wrong such as incompatible class files which can arise if you compile classes on later version of the JVM to the one you are trying to run them on.

Interestingly this problem doesn’t occur on my development machine which is running the latest version of the JDK but happens on the CI server which is running a slightly older release of OpenJDK.