Menu

#179 ClassFormatError (Invalid method Code length) on large enums

open
nobody
None
5
2012-05-30
2012-05-30
No

Cobertura breaks on enum classes containing a large number of elements (over 2000). After instrumenting the class a ClassFormatError is thrown:

java.lang.ClassFormatError: Invalid method Code length 76521 in class file com/example/Foo.class

This is caused by the instrumentation of the static initialization block that instantiate the elements of the enum, after the instrumentation it exceeds the 64K limit.

Maybe it would be possible to break this static block into smaller blocks if the size is more than 64k?

Discussion


Log in to post a comment.