Closed vimil closed 4 years ago
@rliesenfeld Could you take a look at this pull request to implement support for const dynamic.
I'm seeing this with Java 11 as well, in conjunction with jacoco 0.8.4+. Downgraded to 0.8.3 for now as a workaround.
Same as #615.
JDK17+Jmockit 1.44+ jacoco0.8. I am getting the same error
Please provide the following information:
*1.48, 1.49
Below is the stacktrace of the exception
java.lang.ArrayIndexOutOfBoundsException: Index 10316 out of bounds for length 776 at mockit.asm.util.BytecodeReader.readString(BytecodeReader.java:346) at mockit.asm.util.BytecodeReader.readNonnullUTF8(BytecodeReader.java:338) at mockit.asm.util.BytecodeReader.readMethodHandle(BytecodeReader.java:426) at mockit.asm.util.BytecodeReader.readConst(BytecodeReader.java:401) at mockit.asm.util.BytecodeReader.readConstItem(BytecodeReader.java:365) at mockit.asm.methods.MethodReader.readLDCW(MethodReader.java:481) at mockit.asm.methods.MethodReader.readBytecodeInstructionsInCodeBlock(MethodReader.java:405) at mockit.asm.methods.MethodReader.readCode(MethodReader.java:211) at mockit.asm.methods.MethodReader.readMethodBody(MethodReader.java:134) at mockit.asm.methods.MethodReader.readMethod(MethodReader.java:75) at mockit.asm.methods.MethodReader.readMethods(MethodReader.java:62) at mockit.asm.classes.ClassReader.readFieldsAndMethods(ClassReader.java:196) at mockit.asm.classes.ClassReader.accept(ClassReader.java:89) at mockit.internal.expectations.mocking.BaseTypeRedefinition.redefineClass(BaseTypeRedefinition.java:205) at mockit.internal.expectations.mocking.BaseTypeRedefinition.redefineClassAndItsSuperClasses(BaseTypeRedefinition.java:182) at mockit.internal.expectations.mocking.BaseTypeRedefinition.redefineMethodsAndConstructorsInTargetType(BaseTypeRedefinition.java:173) at mockit.internal.expectations.mocking.BaseTypeRedefinition.redefineTargetClassAndCreateInstanceFactory(BaseTypeRedefinition.java:245) at mockit.internal.expectations.mocking.BaseTypeRedefinition.redefineType(BaseTypeRedefinition.java:65) at mockit.internal.expectations.mocking.TypeRedefinition.redefineType(TypeRedefinition.java:28) at mockit.internal.expectations.mocking.FieldTypeRedefinitions.redefineFieldType(FieldTypeRedefinitions.java:78) at mockit.internal.expectations.mocking.FieldTypeRedefinitions.redefineFieldType(FieldTypeRedefinitions.java:65) at mockit.internal.expectations.mocking.FieldTypeRedefinitions.redefineFieldTypes(FieldTypeRedefinitions.java:53) at mockit.internal.expectations.mocking.FieldTypeRedefinitions.<init>(FieldTypeRedefinitions.java:33) at mockit.integration.TestRunnerDecorator.handleMockFieldsForWholeTestClass(TestRunnerDecorator.java:142) at mockit.integration.TestRunnerDecorator.updateTestClassState(TestRunnerDecorator.java:40) at mockit.integration.junit4.JUnit4TestRunnerDecorator.handleMockingOutsideTestMethods(JUnit4TestRunnerDecorator.java:129) at mockit.integration.junit4.JUnit4TestRunnerDecorator.invokeExplosively(JUnit4TestRunnerDecorator.java:37) at mockit.integration.junit4.FakeFrameworkMethod.invokeExplosively(FakeFrameworkMethod.java:29) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at mockit.internal.reflection.MethodReflection.invoke(MethodReflection.java:90) at mockit.internal.BaseInvocation.doProceed(BaseInvocation.java:57) at mockit.Invocation.proceed(Invocation.java:107) at com.cwctravel.framework.test.jmockit.MockFrameworkMethod.invokeExplosively(MockFrameworkMethod.java:43) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:55) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
The issue was partially resolved by adding support for Condy Constant Pool Type but the ByteCodeReader class still needs to be enhanced to read readLDCW byteCode instruction correctly
Here is an initial pullrequest with potential fix #665