net.sourceforge.cobertura.instrument
public class Main extends java.lang.Object
Add coverage instrumentation to existing classes.
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:
After every line in a class has been "instrumented," Cobertura edits the bytecode for the class one more time and adds "implements net.sourceforge.cobertura.coveragedata.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.
Modifier and Type | Field and Description |
---|---|
private ClassPattern |
classPattern |
private java.io.File |
destinationDirectory |
private java.util.Collection |
ignoreBranchesRegexes |
private java.util.Collection |
ignoreRegexes |
private static org.apache.log4j.Logger |
logger |
private ProjectData |
projectData |
Constructor and Description |
---|
Main() |
Modifier and Type | Method and Description |
---|---|
private void |
addInstrumentation(CoberturaFile coberturaFile) |
private void |
addInstrumentationToArchive(Archive archive) |
private void |
addInstrumentationToArchive(CoberturaFile archive) |
private boolean |
addInstrumentationToArchive(CoberturaFile file,
java.io.InputStream archive,
java.io.OutputStream output) |
private boolean |
addInstrumentationToArchive(CoberturaFile file,
java.util.zip.ZipInputStream archive,
java.util.zip.ZipOutputStream output) |
private void |
addInstrumentationToSingleClass(java.io.File file) |
private static boolean |
isClass(java.util.zip.ZipEntry entry) |
static void |
main(java.lang.String[] args) |
private void |
parseArguments(java.lang.String[] args) |
private static final org.apache.log4j.Logger logger
private java.io.File destinationDirectory
private java.util.Collection ignoreRegexes
private java.util.Collection ignoreBranchesRegexes
private ClassPattern classPattern
private ProjectData projectData
public Main()
private static boolean isClass(java.util.zip.ZipEntry entry)
entry
- A zip entry.private boolean addInstrumentationToArchive(CoberturaFile file, java.io.InputStream archive, java.io.OutputStream output) throws java.lang.Exception
java.lang.Exception
private boolean addInstrumentationToArchive(CoberturaFile file, java.util.zip.ZipInputStream archive, java.util.zip.ZipOutputStream output) throws java.lang.Exception
java.lang.Exception
private void addInstrumentationToArchive(Archive archive) throws java.lang.Exception
java.lang.Exception
private void addInstrumentationToArchive(CoberturaFile archive)
private void addInstrumentationToSingleClass(java.io.File file)
private void addInstrumentation(CoberturaFile coberturaFile)
private void parseArguments(java.lang.String[] args)
public static void main(java.lang.String[] args)