尝试在 IntelliJ 中运行单元测试时出现以下错误。从谷歌搜索来看,它似乎与使用 JDK7 和 Powermock 不兼容有关。经常出现的建议是添加 -XX:-UseSplitVerifier 标志。我已经按照以下说明进行了尝试:(如何在 Mac 上的 IntelliJ IDEA 中增加 IDE 内存限制?)但继续出现错误。
有没有其他人遇到过这个问题并解决了?
java.lang.VerifyError: Inconsistent stackmap frames at branch target 48 Exception Details: Location:
com/marketplace/impl/MarketplaceLibTestBase.<init>(Lorg/powermock/core/IndicateReloadClass;)V @48: aload_2 Reason:
Type uninitializedThis (current frame, locals[2]) is not assignable to 'com/marketplace/impl/MarketplaceLibTestBase' (stack map, locals[2]) Current Frame:
bci: @34
flags: { flagThisUninit }
locals: { uninitializedThis, 'org/powermock/core/IndicateReloadClass', uninitializedThis, 'org/powermock/core/IndicateReloadClass', top, 'java/lang/Object' }
stack: { 'java/lang/Object', 'java/lang/Object' } Stackmap Frame:
bci: @48
flags: { flagThisUninit }
locals: { uninitializedThis, 'org/powermock/core/IndicateReloadClass', 'com/marketplace/impl/MarketplaceLibTestBase', 'org/powermock/core/IndicateReloadClass' }
stack: { } Bytecode:
0000000: 2a2b 4e4d 1312 9bb8 129d 04bd 0011 5903
0000010: 2d53 1312 9eb8 12a0 b812 a23a 0519 05b2
0000020: 12a4 a500 0e2a 01c0 0022 b712 a6a7 000a
0000030: 2c2d b712 a801 57b1 Stackmap Table:
append_frame(@48,Object[#45],Object[#34])
chop_frame(@55,2)
at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2531) at java.lang.Class.privateGetPublicMethods(Class.java:2651) at java.lang.Class.getMethods(Class.java:1467) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.getTestMethods(PowerMockJUnit44RunnerDelegateImpl.java:108) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.<init>(PowerMockJUnit44RunnerDelegateImpl.java:84) at org.powermock.modules.junit4.internal.impl.PowerMockJUnit47RunnerDelegateImpl.<init>(PowerMockJUnit47RunnerDelegateImpl.java:42) 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:526) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:154) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:49) at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:231) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:69) at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:36) at org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:27) 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:526) 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 com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:44) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Process finished with exit code 255