[jboss-jira] [JBoss JIRA] (JASSIST-215) CLONE - "VerifyError: Inconsistent stackmap frames" from PowerMock (using Javassist 3.18.1)

Laurent GARCIA (JIRA) jira-events at lists.jboss.org
Tue Nov 26 10:29:06 EST 2013


     [ https://issues.jboss.org/browse/JASSIST-215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Laurent GARCIA updated JASSIST-215:
-----------------------------------

        Fix Version/s:     (was: 3.19.0-GA)
                           (was: 3.18.1-GA)
    Affects Version/s: 3.18.1-GA
                           (was: 3.18.0-GA)
          Environment: jdk1.7.0_25  (was: jdk1.7.0_21, Win8amd64)
          Description: 
So the new release 3.18.1-GA with powermock is better, but if you have a switch case on an enumeration in the test, the error is still here


  was:
Apologies if this is a duplicate of JASSIST-204. I didn't delve into the actual Javassist APIs used, I'm simply seeing an error in my PowerMock usage. Fortunately, this ticket provides a very simple test case for reproducibility.

I was prompted to open a Javassist ticket by the following PowerMock ticket: https://code.google.com/p/powermock/issues/detail?id=355

I'm attaching a very simple maven project with a unit test to demonstrate the problem.

Here are the guts of the failing unit test:

{code}
@RunWith(PowerMockRunner.class)
@PrepareForTest( {MyClassUnderTest.class} )
public class PowerMockTest {

	/**************************************************************************
	 * Demonstrates an "Inconsistent stackmap frames" exception that results
	 * from PowerMock 1.5 and JDK 7.
	 *************************************************************************/
	@Test
	public void testWaitForExitMockMonitors() throws InterruptedException {
		resetAll();
		
		Object mockMonitor = createStrictMock(Object.class);
		MyClassUnderTest myClass = new MyClassUnderTest(mockMonitor);
		
		mockMonitor.wait(0);
		mockMonitor.notifyAll();
		
		replayAll();
		
		myClass	.run();
		
		verifyAll();
	}
	
	public static class MyClassUnderTest {
		private Object m_monitor;
		
		public MyClassUnderTest(Object monitor) {
			m_monitor = monitor;
		}
		
		public void run() throws InterruptedException {
			m_monitor.wait(0);
			m_monitor.notifyAll();
		}
	}
}
{code}

And here is my error:

{code}
java.lang.VerifyError: Inconsistent stackmap frames at branch target 283 in method com.scea.dart.cmd.targetcontrol.target.process.PowerMockTest.testWaitForExitMockMonitors()V at offset 274
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
	at java.lang.Class.privateGetPublicMethods(Class.java:2571)
	at java.lang.Class.getMethods(Class.java:1429)
	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.getTestMethods(PowerMockJUnit44RunnerDelegateImpl.java:95)
	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.<init>(PowerMockJUnit44RunnerDelegateImpl.java:71)
	at org.powermock.modules.junit4.internal.impl.PowerMockJUnit49RunnerDelegateImpl.<init>(PowerMockJUnit49RunnerDelegateImpl.java:29)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
	at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:143)
	at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:39)
	at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:217)
	at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:59)
	at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:32)
	at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:33)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
	at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
	at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
	at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
	at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
{code}



    
> CLONE - "VerifyError: Inconsistent stackmap frames" from PowerMock (using Javassist 3.18.1)
> -------------------------------------------------------------------------------------------
>
>                 Key: JASSIST-215
>                 URL: https://issues.jboss.org/browse/JASSIST-215
>             Project: Javassist
>          Issue Type: Bug
>    Affects Versions: 3.18.1-GA
>         Environment: jdk1.7.0_25
>            Reporter: Laurent GARCIA
>            Assignee: Shigeru Chiba
>
> So the new release 3.18.1-GA with powermock is better, but if you have a switch case on an enumeration in the test, the error is still here

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list