net.sourceforge.cobertura.instrument
Class Main
java.lang.Object
net.sourceforge.cobertura.instrument.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:
- Get an instance of the ProjectData class.
- Call a method in this ProjectData 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
"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.
Constructor Summary |
Main()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
private static final org.apache.log4j.Logger logger
destinationDirectory
private java.io.File destinationDirectory
ignoreRegexes
private java.util.Collection ignoreRegexes
ignoreBranchesRegexes
private java.util.Collection ignoreBranchesRegexes
classPattern
private ClassPattern classPattern
projectData
private ProjectData projectData
Main
public Main()
isClass
private static boolean isClass(java.util.zip.ZipEntry entry)
- Parameters:
entry
- A zip entry.
- Returns:
- True if the specified entry has "class" as its extension,
false otherwise.
addInstrumentationToArchive
private boolean addInstrumentationToArchive(CoberturaFile file,
java.io.InputStream archive,
java.io.OutputStream output)
throws java.lang.Exception
- Throws:
java.lang.Exception
addInstrumentationToArchive
private boolean addInstrumentationToArchive(CoberturaFile file,
java.util.zip.ZipInputStream archive,
java.util.zip.ZipOutputStream output)
throws java.lang.Exception
- Throws:
java.lang.Exception
addInstrumentationToArchive
private void addInstrumentationToArchive(Archive archive)
throws java.lang.Exception
- Throws:
java.lang.Exception
addInstrumentationToArchive
private void addInstrumentationToArchive(CoberturaFile archive)
addInstrumentationToSingleClass
private void addInstrumentationToSingleClass(java.io.File file)
addInstrumentation
private void addInstrumentation(CoberturaFile coberturaFile)
parseArguments
private void parseArguments(java.lang.String[] args)
main
public static void main(java.lang.String[] args)