vijayjcp / powermock

Automatically exported from code.google.com/p/powermock
Apache License 2.0
0 stars 2 forks source link

Static mocks throw java.lang.VerifyError when using Java 7 language features. #427

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Class uses Java 7 language features
2. PowerMock mocks with mockStatic 
3. No profit

What is the expected output?
Test runs

What do you see instead?
java.lang.VerifyError: Stack map does not match the one at exception handler 75 
in method org.app.Foo.bar()Ljava/lang/String; at offset 72

In the Foo class the following does NOT run

try {
    return "baz";
} catch (FileSystemAlreadyExistsException | ConcurrentModificationException e) {
    System.out.println("error");
    return null;
}

Changing it to this works fine

try {
    return "baz";
} catch (FileSystemAlreadyExistsException e) {
    System.out.println("error");
    return null;
} catch (ConcurrentModificationException e) {
    System.out.println("error");
    return null;
}

What version of the product are you using? On what operating system?
PowerMock 1.5
Mockito 1.9.5
javassist 3.17.1-GA
java 1.7.0_11 x64
Windows 7 x64
Project target / language level / compiler: 1.7

Test case attached

Original issue reported on code.google.com by nho...@gmail.com on 30 Jan 2013 at 6:29

Attachments:

GoogleCodeExporter commented 8 years ago
I suspect that this is a Javassist issue.. Perhaps you could report this to the 
Javassist team?

Original comment by johan.ha...@gmail.com on 2 Feb 2013 at 11:05

GoogleCodeExporter commented 8 years ago
Reproduced w/o powermock and reported at 
https://issues.jboss.org/browse/JASSIST-190

Original comment by nho...@gmail.com on 5 Feb 2013 at 8:44

GoogleCodeExporter commented 8 years ago
Thanks for your help. I'll mark it as "WontFix" if it's ok by you. When 
Javassist releases a new version it'll of course be shipped with PowerMock.

Original comment by johan.ha...@gmail.com on 6 Feb 2013 at 12:27