Vivek HJ
Vivek HJ

Reputation: 231

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

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

Upvotes: 1

Views: 5361

Answers (6)

rogerdpack
rogerdpack

Reputation: 66751

fixed similar issue "java.lang.VerifyError" (didn't mention stackmap) when creating a mock, by bumping mockito version from 2.5.0 to 2.24.5 FWIW...

Upvotes: 0

Anushka Senarathna
Anushka Senarathna

Reputation: 169

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>

Upvotes: 0

Fia
Fia

Reputation: 1

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

Upvotes: 0

sharma_kunal
sharma_kunal

Reputation: 2192

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.

Upvotes: 0

maoren
maoren

Reputation: 31

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>

Upvotes: 3

Vasco Lameiras
Vasco Lameiras

Reputation: 364

Which JDK version are you using?

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

Upvotes: 6

Related Questions