Jenkins/Buckminster/Emma NoSuchMethodError – Specify packages to instrument

The eclipse tool project provides the Buckminster project to automate the build process for eclipse plugins, features and update sites.
The jenkins continuous integration server also provides a plugin to integrate buckminster into the automated build process.
A good continuous integration process also includes the execution of unit tests and to perform a code coverage analysis to get the information how much of your code is covered by your unit tests.
Buckminster comes with an integration of the widely used emma code coverage tooling. This setup is also very useful to build your eclipse-based software because buckminster, junit and emma are also available as plugins for your eclipse IDE.

However, emma sometimes run into problems when facing code which has been generated. While it is instrumenting the byte code, there are some character combinations it is not able to process correctly.
As described in this emma bug tracker issue (http://sourceforge.net/projects/emma/forums/forum/373867/topic/3263702), a String such as String bad=”\1\123″; let the emma instrumentation fail. Such code also tends to be created by tools such as ANTLr and can not easily be changed manually.

A typical exception you will notice looks like:

java.lang.NoSuchMethodError: com.vladium.emma.rt.RT.\u0001S([[ZLjava/lang/String;J)V

While the according bug (http://sourceforge.net/tracker/?func=detail&aid=1977924&group_id=108932&atid=651897) is not fixed yet, the only chance to get such a case working is to exclude the bad code from instrumentation.
The coverage launch configuration dialog shipped with the eclipse IDE integration allows to check those packages and libraries you would like to instrument or not.
The same applies for the emma ANT task and the emma command line interface which provide according filter arguments (http://emma.sourceforge.net/reference/ch02s06s02.html).

ANT Settings:



Command line parameters:

>java emma ... -ix -com.foo.*Test* -ix @myfilters.txt ...

However, the buckminster integration of emma does not provide an according parameter for the emma command. Also the settings stored in the launch configuration file by the eclipse coverage run dialog is not taken into account by the buckminster emma integration.

Auto-generated eclipse coverage launch configuration settings






The only chance you have is a parameter which is not documented or accessible throught the eclipse ui or the buckminster emma command.
You have to manually adapt the eclipse launch configuration file executed by the buckminster emma command. The parameter is internally interpreted by the emma tooling when processing this file.
The parameter is named com.mountainminds.eclemma.core.INSTRUMENTATION_PATHS and specifies a list of directories containing the byte code to be instrumented.

INSTRUMENTATION_PATHS setting in the launch configuration file:






Note that this list is an include definition and you have to specify all the code which should be instrumented. It is not possible to simply exclude those packages / projects which contain the bad code. Furthermore, this list might need to be updated in the future if code of more projects is executed by your tests and you would like to have this included in your coverage report. And you will not be notified about such a situation.

Leave a Comment