Question

I have a quick question. Looking for some help.

I am doing code coverage for my simple java file using emma. I am stuck up at the point of running the instrumented class file. I am doing this all from ANT build.xml file. When I try to run this instrumented class file, I get the below error:

[java] java.lang.VerifyError: Expecting a stackmap frame at branch target 11

Please let me know if you want my entire build.xml. Will be happy to share.

From forums, I see we can use XX Splitverifier. I don't know how to use this in ANT build.xml file. Can anyone please share your answer?

Was it helpful?

Solution

I found a good explanation of this problem here:

Problems actually arise if you're using bytecode manipulating tools, such as AspectJ in static weaving mode - I do - that haven't been updated yet. They basically read the bytecode, tagged as Java 7 bytecode, and perform changes in Java 6 mode, saving the results still tagged in Java 7 mode. Thus, the VM in JDK 7 sees Java 7 bytecode and activates the new Java 7 verifier, which fails (or can fail) when it meet the bytecode manipulated in Java 6 mode.

It seems complicated, but the simple solution is to force the use of the old verifier in JDK 7 by adding this VM runtime option: -XX:-UseSplitVerifier.

So this is a backward compatibility problem. You're faced with a choice of applying the work-around or changing your code coverage tool.

Do you have a strong reason to use Emma? Jacoco has emerged as its replacement. I would also recommend using SonarQube, which will additionally integrate Findbugs, PMD and Checkstyle into your build process. For an example on how this all works in ANT see the following answer:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top