jCoverage/GPL update 1.0.5b

After a week and no real response from the jCoverage team, I’ve decided to make my patch available. I’ve called this patch 1.0.5b so that it will not conflict with the jCoverage naming if they ever decide to update the jCoverage/GPL from their website.
The patch is available here and needs to be applied to the jCoverage 1.0.5 src download.
Warning: You will need either a Unix system, or a Windows system with the patch command available, using either Cygwin, or a native Windows patch.
For those who are unsure on how to best do this follow these simple instructions:

  1. Unpack the original source into a directory. This will actually create a directory called jcoverage-1.0.5. For the sake of the example, let’s assume that it was unpacked into /usr/local/src/jcoverage-1.0.5
  2. Now change directory to the directory above jcoverage-1.0.5, in this case /usr/local/src
  3. Download the update105-105b.zip patch file from the above link to this directory and unzip it
  4. Issue the command patch -p0 < update105-105b.dif
  5. Finally, edit the build.properties file and change the product.version from 1.0.4 to 1.0.5b

If using Ant to compile, then delete 2 entries in the build.xml that are <exec dir="${build.dir}" executable="bk"> as it is likely that you don’t have the bk executable on your system.
Then compile with ant clean compile jar or use your favourite IDE. (Note, using an IDE will end up with a missing Version.java, simply copy the Version.j file in the same directory to Version.java and change the value of the string (should you care).
Enjoy the new features. This means that it works with large (at least 822) filesets of class files on Windows, and if use the <instrument> target with the following:
<instrument ignorejavabean=”true”> then jCoverage will ignore getters and setters that are considered “simple”. The algorithm for determining simplicity is by examining the number of instructions that exist in the method, according to BCEL. It turns out that a getter with only a return foo; has 6 instructions and a setter with this.foo = foo has 10 instructions. So anything less that 11 instructions is considered “simple” and not instrumented.
Enjoy, and if you’ve got any problems, leave me a comment, or send me an email. I’m still hoping that this will make it into a jCoverage/GPL release soon, otherwise I’ll fork the codebase and host it locally.

Advertisements

3 thoughts on “jCoverage/GPL update 1.0.5b

  1. Of course, you could get the same effect by using a standard naming convention for your beans or putting them in the same package and excluding them from instrumentation based on fileset matching.
    This is how I handle beans (e.g. DTO’s/VO’s) as well as specialized exceptions.

Comments are closed.