Cryptic java.lang.IndexOutOfBoundsException if coverage tool is enabled #264

Closed
printingin3d opened this Issue Mar 1, 2016 · 0 comments

Projects

None yet

2 participants

@printingin3d

Please provide the following information:

  • Version of JMockit that was used:
    1.21 and 1.22
  • Description of the problem or enhancement request:
    Checkout the code from the following place: https://github.com/printingin3d/javascad and run mvn clean install

The result some cryptic exception during the test run, originated in the Area2d class:

java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at eu.printingin3d.javascad.models2d.Area2d.getIteratorCrossing(Area2d.java:163)
at eu.printingin3d.javascad.models2d.Area2d.union(Area2d.java:251)

The funfact is: I got the same error if the lineSegmentSeries method returns with a Vector, instead of ArrayList. More than that - as it can be seen in the commented out lines - I rewrote that enhanced for loop to a classic for loop, and then the above exception has been thrown in the very first line after the for loop. Even if it is just a System.out.println("hello").

If I comment the coverage tool out in the pom.xml the problem doesn't occur.

I haven't spend any time to try to minimize the code site which produces the error - I'll try later, but I wanted to open an issue. Maybe it will be familiar to someone.

@rliesenfeld rliesenfeld added the bug label Mar 2, 2016
@rliesenfeld rliesenfeld self-assigned this Mar 2, 2016
@rliesenfeld rliesenfeld added a commit that closed this issue Mar 5, 2016
@rliesenfeld rliesenfeld Coverage tool: fixed path coverage bug that caused IndexOutOfBoundsEx…
…ception for methods containing an anonymous class; closes #264.
551674a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment