lishunli / powermock

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

Test generates java.lang.VerifyError: Inconsistent stackmap frames at branch target #355

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I suspect this may be a manifestation of this issue: 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=339388.  It wasn't clear if this 
is a Java issue, or something that needs to be fixed on a product-by-product 
basis, so I thought I'd bring it to your attention just in case.

What steps will reproduce the problem?
1. Compiling and running my project with Java 1.7.0_01 on Windows  (I tried to 
isolate the problem, but it only appears in the context of the entire project.)

What is the expected output? What do you see instead?

When I run certain tests (described below), I get the following runtime error:
1) 
testOpenWriter_file_string_autoflush_setsEncodings(edu.gvsu.kurmasz.warszawa.io.
OutputHelperTest2)
java.lang.VerifyError: Inconsistent stackmap frames at branch target 134 in 
method edu.gvsu.kurmasz.warszawa.io.OutputHelperTest2$CharsetTes
ter.values()[Ledu/gvsu/kurmasz/warszawa/io/OutputHelperTest2$CharsetTester; at 
offset 126
        at edu.gvsu.kurmasz.warszawa.io.OutputHelperTest2.testOpenWriter_file_string_autoflush_setsEncodings(OutputHelperTest2.java:353)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:66)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runTestMethod(PowerMoc
kJUnit44RunnerDelegateImpl.java:307)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:86)
        at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:94)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.executeTest(PowerMockJ
Unit44RunnerDelegateImpl.java:294)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTestInSuper(Pow
erMockJUnit47RunnerDelegateImpl.java:112)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl$PowerMockJUnit47MethodRunner.executeTest(PowerMockJ
Unit47RunnerDelegateImpl.java:73)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$PowerMockJUnit44MethodRunner.runBeforesThenTestThen
Afters(PowerMockJUnit44RunnerDelegateImpl.java:282)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.invokeTestMethod(PowerMockJUnit44RunnerDelegateImpl
.java:207)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.runMethods(PowerMockJUnit44RunnerDelegateImpl.java:
146)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl$1.run(PowerMockJUnit44RunnerDelegateImpl.java:120)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
        at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.run(PowerMockJUnit44RunnerDelegateImpl.java:118)
        at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run(JUnit4TestSuiteChunkerImpl.java:102)
        at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.run(AbstractCommonPowerMockRunner.java:53)
        at org.junit.runners.Suite.runChild(Suite.java:128)
        at org.junit.runners.Suite.runChild(Suite.java:24)

What version of the product are you using? On what operating system?
I'm using java 1.7.0_01 on Windows with the following jar files:
cglib-nodep-2.2.jar               junit-4.8.2.jar                   
objenesis-1.2.jar
javassist-3.15.0-GA.jar           mockito-all-1.8.5.jar             
powermock-mockito-1.4.10-full.jar

Please provide any additional information below.
* Everything works fine I compile the project using java 1.6.
* Everything works fine if I run the tests using this flag: 
-XX:-UseSplitVerifier 
* If I take the offending class and its test and move them to a new project, 
the problem disappears (i.e., I can't seem to isolate the problem in a small 
example.)

Thus, I suspect this may be a manifestation of this issue: 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=339388.  It wasn't clear if this 
is a Java issue, or something that needs to be fixed on a product-by-product 
basis.

If it helps, I've also attached a copy of the test file.  The problem seems to 
be related to the enum CharacterTester 

Original issue reported on code.google.com by kurm...@gmail.com on 6 Nov 2011 at 2:23

Attachments:

GoogleCodeExporter commented 9 years ago
javassist is even don't mentioned in stack trace, so I'm not sure what I can 
bring to them.

BTW, I think -XX:-UseSplitVerifie doesn't cause failure in other tests, it is 
just that tests fail when running on Java 7 because some of them require 
specific order which was more stable on Java 6.

Original comment by lystoc...@gmail.com on 3 Feb 2013 at 7:13

GoogleCodeExporter commented 9 years ago
Well PowerMock uses Javassist for byte-code manipulation and there has been 
some problems with PowerMock and stackmap generation before and the new release 
of Javassist seems to have resolved it for most people.

Original comment by johan.ha...@gmail.com on 3 Feb 2013 at 8:40

GoogleCodeExporter commented 9 years ago
I just noticed that I have to use -XX:-UseSplitVerifier, too, to make PowerMock 
run on my Java 7 tests. Poor, as it is a vendor-specific option. :-(

I wanted to kindly ask if there is a schedule when to get this working without 
that switch? :-)

Original comment by headcrashing on 13 Feb 2013 at 8:49