3

I am using Cobertura for my code coverage but while running the test cases all of the test cases are getting failed with below error when I run the test cases using a maven build.

 Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0x0000000: 033d 11ff ff3e 125b 1102 1fb8 0061 2a2b
    0x0000010: 1102 1f3d 1100 003e c600 1912 5b1c 1d04
    0x0000020: b800 b511 ffff 3e2b b600 bbc0 00b7 a700
    0x0000030: 141d 9b00 0f12 5b1c 1d03 b800 b511 ffff
    0x0000040: 3e01 b500 c012 5b11 0220 b800 61b1  

But when I run the same test cases using Eclipse run as JUnit command it works fine.

Yuri
  • 4,254
  • 1
  • 29
  • 46
Siva
  • 1,938
  • 1
  • 17
  • 36
  • Sometimes it helps to simply disable bytecode verification - see here: http://stackoverflow.com/questions/300639/use-of-noverify-when-launching-java-apps – GhostCat Aug 31 '16 at 09:42
  • @GhostCat tried that but it didn't workorg.codehaus.mojo cobertura-maven-plugin 2.5.1 -noverify – Siva Aug 31 '16 at 09:45
  • Then I suggest: carefully carefully study what eclipse is doing differently when invoking JUnit. Which libraries, which JVM settings, whatever. – GhostCat Aug 31 '16 at 09:47

2 Answers2

1

In Eclipse just Right Click & in in cover configurations & add
-XX:-UseSplitVerifier to the VM Arguments in the arguments tab

Yuri
  • 4,254
  • 1
  • 29
  • 46
1

In my case, using AdoptJDK 11, I was able to get rid of the error using the -noverify VM argument. However, Cobertura doesn't support Java 1 :(

For Gradle users:

test {
    jvmArgs '-noverify'
}
Yuri
  • 4,254
  • 1
  • 29
  • 46