net.sourceforge.cobertura.coverage
Class Main

java.lang.Object
  extended bynet.sourceforge.cobertura.coverage.Main

public class Main
extends java.lang.Object

Add coverage instrumentation to existing classes.

What does that mean, exactly?

It means Cobertura will look at each class you give it. It loads the bytecode into memory. For each line of source, Cobertura adds a few extra instructions. These instructions do the following:

  1. Get an instance of the CoverageData class.
  2. Call a method in this CoverageData class that increments a counter for this line of code.

After every line in a class has been "instrumented," Cobertura edits the bytecode for the class one more time and adds an "implements net.sourceforge.cobertura.coverage.HasBeenInstrumented" This is basically just a flag used internally by Cobertura to determine whether a class has been instrumented or not, so as not to instrument the same class twice.


Field Summary
private  java.io.File baseDir
           
private  java.io.File destinationDirectory
           
private  java.util.regex.Pattern ignoreRegexp
           
private static org.apache.log4j.Logger logger
           
 
Constructor Summary
Main()
           
 
Method Summary
private  void addInstrumentation(java.io.File file)
           
private  void addInstrumentation(java.lang.String filename)
           
private static boolean isClass(java.io.File file)
           
static void main(java.lang.String[] args)
           
private  void parseArguments(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.apache.log4j.Logger logger

destinationDirectory

private java.io.File destinationDirectory

baseDir

private java.io.File baseDir

ignoreRegexp

private java.util.regex.Pattern ignoreRegexp
Constructor Detail

Main

public Main()
Method Detail

isClass

private static boolean isClass(java.io.File file)
Parameters:
file - A file.
Returns:
True if the specified file has "class" as its extension, false otherwise.

addInstrumentation

private void addInstrumentation(java.io.File file)

addInstrumentation

private void addInstrumentation(java.lang.String filename)

parseArguments

private void parseArguments(java.lang.String[] args)

main

public static void main(java.lang.String[] args)