java.lang.RuntimeException: Method code too large!

1,258 views
Skip to first unread message

rahul.s...@gmail.com

unread,
Aug 12, 2016, 11:12:31 AM8/12/16
to JaCoCo and EclEmma Users
Hi,

Nice to see this group. I have been working on jacoco to implement code coverage of the product I am working on. For some classes, I am getting the subject exception. This problem comes when a method is having so many lines that exceeding Jacoco's limit (64KB). I googled for the possible solution of this problem and found to divide the method in multiple smaller methods. Dividing methods is very big task for me. Is there any other solution for this problem e.g.

1. Can increase this limit
2. Is there any commercial version of Jacoco that has more method size limit

Any help would be highly appreciated.

Thanks!

Evgeny Mandrikov

unread,
Aug 12, 2016, 2:03:02 PM8/12/16
to JaCoCo and EclEmma Users, rahul.s...@gmail.com
Hi,

There is no way to increase this limit, because it comes from Java Virtual Machine Specification, which states that

The value of the code_length item must be less than 65536.


During instrumentation JaCoCo adds instructions to bytecode to record coverage, so that after instrumentation method can become too big violating statement above.

I don't know any instrumentation tool (commercial or not), which is able to deal with such kind of increase - splitting of a method automatically is not a trivial task.
As of today JaCoCo team does not have plans to invest time into such task.

So IMO the only options are:
either refactor your code to split it on smaller methods,
either exclude class(es) with such method(s).

Best regards,
Evgeny

rahul.s...@gmail.com

unread,
Aug 12, 2016, 4:15:13 PM8/12/16
to JaCoCo and EclEmma Users, rahul.s...@gmail.com

Thanks Evgeny! Appreciate it!

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages