Monday, April 22, 2013

java.lang.VerifyError with Java 7 and Cobertura

I just added Cobertura to a Java 7 project and was disappointed that my unit tests started failing with:
 java.lang.VerifyError: Expecting a stackmap frame at branch target blah...  
Looks like cobertura's byte code instrumentation is not compatible with Java 7.  Java 7 changed the class format with the addition of a stack map used for verification and cobertura hasn't caught up yet - if ever.

Oracle does provide a way around the problem by using the -XX:UseSplitVerifier VM option.  I added it as an argument to the surefire-plugin configuration in my maven pom file.


  1. It looks like the Cobertura development team are working on Version 2. I see github comments that indicate support for Java 7. Coming soon I guess.

  2. Thanks for your blog... It helped to solve issue mentioned here...