mockito - java.lang.VerifyError: Inconsistent stackmap frames at branch target

java/lang verifyerror inconsistent stackmap frames at branch target 13
java lang verifyerror expecting a stackmap frame at branch target powermock
java lang verifyerror junit eclipse
java.lang.verifyerror expecting a stackmap frame at branch target java 8
error java lang verifyerror expecting a stackmap frame at branch target 35
jacocoinit()(z @4: ifnonnull)
java/lang verifyerror stack map does not match the one at exception handler 9
current frame's stack size doesn't match stackmap
java.lang.VerifyError: Inconsistent stackmap frames at branch target 775
Exception Details:
Location:
    com/../..../class.method()
Reason:
    Type 'java/sql/Connection' (current frame, locals[6]) is not assignable to 'java/lang/Class' (stack map, locals[6])

This is what I get when I try to execute junit.

junit 4.8.1 org.mockito 1.8.5 org.powermock 1.3.9 javassist 3.12.0-GA


Which JDK version are you using?

I had a similar issue and solved it by adding -noverify to the JVM arguments.

java.lang.VerifyError: Inconsistent stackmap frames at branch target , hi! I also ran into the same problem, but I found that the jar error resulted in the addition of the mockito-all.XX.jar in my  $ javac FooDemo.java $ java FooDemo Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 9 $ java -XX:-UseSplitVerifier FooDemo Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0 Exception in thread "main" java.lang.VerifyError: Expecting a stackmap


if you use jdk8+,you maybe need update javassist,javassist 3.20- is not support jdk8+.

<dependency>
    <groupId>org.javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.20.0-GA</version>
    <scope>test</scope>
</dependency>

mockito, Which JDK version are you using? I had a similar issue and solved it by adding -​noverify to the JVM arguments. Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.


I was facing the same issue.As i was using Proguard at my end.So i added

**-dontpreverify**

in proguard.txt file. Beause this issue is related to Java 7

You can check here:- [enter link description here][1] 

  [1]: http://proguard.sourceforge.net/manual/usage.html

The above case is if you are using proguard.

[Mockito + Powermock] java.lang.VerifyError: Inconsistent stackmap , 6. <pre>java.lang.VerifyError: Inconsistent stackmap frames at branch target 40 in method. your.package.YourTest.()V at offset 26. at java.lang. Also note that I am using Java 8, and cannot downgrade to v7 or v6 as mentioned here: java.lang.VerifyError: Expecting a stackmap frame at branch target. I also tried adding the surefire plugin in the pom file, as mentioned here: java.lang.VerifyError: Expecting a stackmap frame at branch target 73. None of these solutions work in this case.


I had similar issues using JDK 1.7.0_79, and I could solve it by adding below argument to VM argument. -noverify

[JASSIST-205] "VerifyError: Inconsistent stackmap frames" from , java.lang.VerifyError: Inconsistent stackmap frames at branch target 283 in method com.scea.dart.cmd.targetcontrol.target.process.PowerMockTest. Tried it by excluding javassist 3.15.0-GA dependency from the powermock dependency in the pom.xml and instead explicitly adding a 3.16.0-GA dependency. But still got the same exception: java.lang.VerifyError: Inconsistent stackmap frames at branch target 1193 in method at offset 1182.


Below option has worked for me. My java version is 1.8.0_181

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-easymock</artifactId>
        <version>${powermock.version}</version>
        <scope>test</scope>
        <exclusions>
                <exclusion>
                    <groupId>org.javassist</groupId>
                        <artifactId>javassist</artifactId>
                </exclusion>
            </exclusions>
    </dependency>

    <dependency>
        <groupId>org.javassist</groupId>
        <artifactId>javassist</artifactId>
        <version>3.21.0-GA</version>
        <scope>test</scope>
    </dependency>

[#LPS-48200] Exception thrown when running unit tests with source , When changing portal source and target level to 1.7 the mockito throws exception when Inconsistent stackmap frames at branch target 40 Exception Details: Location: 'java/lang/Object' } Stackmap Frame: bci: @40 flags: { flagThisUninit } locals: VerifyError: Inconsistent stackmap frames at branch target 40 Exception​  Description Here at Leanplum, we develop an SDK for our customers. We are running our unit tests against our actual source code. Our customers however happen to run their unit tests with our compiled jar file.


PowerMock and Java 7 (Java 1.7), Are there any known issues with PowerMock and Java 7? I'm getting this: java.​lang.VerifyError: Expecting a stackmap frame at branch target 71 in method at java.lang.Class. 3.15.0, mockito 1.8.5, junit 4.8.2, powermockito 1.4.10) and the error VerifyError: Inconsistent stackmap frames at branch target EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - $ javac VerifyBug.java $ java VerifyBug ACTUAL - $ javac VerifyBug.java $ java VerifyBug Exception in thread "main" java.lang.VerifyError: Inconsistent stackmap frames at branch target 84 Exception Details: Location: VerifyBug.problematicMethod(I)V @84: goto Reason: Type top (current frame, locals[4


JDK-8067429 java.lang.VerifyError: Inconsistent stackmap , VerifyBug.java $ java VerifyBug Exception in thread "main" java.lang.​VerifyError: Inconsistent stackmap frames at branch target 84 Exception Details: Location:  Java 7 introduced a stricter verification and changed the class format a bit -- to contain a stack map, used to verify that code is correct. The exception you see, means that some method doesn't have a valid stack map.


How to use PowerMock with Java 7 – Triona Weblog, A common combination is Mockito and PowerMock, because Mockito doesn't VerifyError: Inconsistent stackmap frames at branch target 40 in method your.​package. getDeclaredMethods0(Native Method) at java.lang. I suspect this may be a manifestation of this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=339388. It wasn&#39;t clear if this is a Java issue, or something