New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A test class containing the opcode iinc_w causes ArrayIndexOutOfBoundsException #485

Closed
hagami opened this Issue Nov 29, 2017 · 1 comment

Comments

2 participants
@hagami

hagami commented Nov 29, 2017

  • Version of JMockit that was used:
    JMockit1.37

  • Description of the problem:
    A test class below throws ArrayIndexOutOfBoundsException with no StackTrace.

import org.junit.Test;

public class TestClass {
    @Test
    public void test() {
        int i = 0;
        i += 1000; // compiled to opcode iinc_w
    }
}

I traced and found that the exception was thrown at mockit.external.asm.MethodReader.readAllLabelsInCodeBlock(MethodReader.java:339)
and it was caused by comparison of opcode IINC at MethodReader.java:354.

Opcodes.IINC should be used, not InstructionType.IINC.

Same pattern found in MethodReader.readWideInstruction.

@rliesenfeld rliesenfeld self-assigned this Nov 29, 2017

@rliesenfeld rliesenfeld added the bug label Nov 29, 2017

@rliesenfeld

This comment has been minimized.

Show comment
Hide comment
@rliesenfeld

rliesenfeld Nov 29, 2017

Member

Thanks for reporting it!

Member

rliesenfeld commented Nov 29, 2017

Thanks for reporting it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment