Class CoverageTransformer
java.lang.Object
org.jacoco.agent.rt.internal.CoverageTransformer
- All Implemented Interfaces:
ClassFileTransformer
Class file transformer to instrument classes for code coverage analysis.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate final ClassFileDumperprivate final WildcardMatcherprivate final WildcardMatcherprivate final booleanprivate final booleanprivate final WildcardMatcherprivate final Instrumenterprivate final IExceptionLogger -
Constructor Summary
ConstructorsConstructorDescriptionCoverageTransformer(IRuntime runtime, AgentOptions options, IExceptionLogger logger) New transformer with the given delegates. -
Method Summary
Modifier and TypeMethodDescription(package private) booleanfilter(ClassLoader loader, String classname, ProtectionDomain protectionDomain) Checks whether this class should be instrumented.private booleanhasSourceLocation(ProtectionDomain protectionDomain) Checks whether this protection domain is associated with a source location.private static Stringbyte[]transform(ClassLoader loader, String classname, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ClassFileTransformer
transform
-
Field Details
-
AGENT_PREFIX
-
instrumenter
-
logger
-
includes
-
excludes
-
exclClassloader
-
classFileDumper
-
inclBootstrapClasses
private final boolean inclBootstrapClasses -
inclNoLocationClasses
private final boolean inclNoLocationClasses
-
-
Constructor Details
-
CoverageTransformer
New transformer with the given delegates.- Parameters:
runtime- coverage runtimeoptions- configuration options for the generatorlogger- logger for exceptions during instrumentation
-
-
Method Details
-
transform
public byte[] transform(ClassLoader loader, String classname, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException - Specified by:
transformin interfaceClassFileTransformer- Throws:
IllegalClassFormatException
-
filter
Checks whether this class should be instrumented.- Parameters:
loader- loader for the classclassname- VM name of the class to checkprotectionDomain- protection domain for the class- Returns:
trueif the class should be instrumented
-
hasSourceLocation
Checks whether this protection domain is associated with a source location.- Parameters:
protectionDomain- protection domain to check (ornull)- Returns:
trueif a source location is defined
-
toVMName
-