Package org.jacoco.agent.rt.internal
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 String
private final ClassFileDumper
private final WildcardMatcher
private final WildcardMatcher
private final boolean
private final boolean
private final WildcardMatcher
private final Instrumenter
private final IExceptionLogger
-
Constructor Summary
ConstructorsConstructorDescriptionCoverageTransformer
(IRuntime runtime, AgentOptions options, IExceptionLogger logger) New transformer with the given delegates. -
Method Summary
Modifier and TypeMethodDescription(package private) boolean
filter
(ClassLoader loader, String classname, ProtectionDomain protectionDomain) Checks whether this class should be instrumented.private boolean
hasSourceLocation
(ProtectionDomain protectionDomain) Checks whether this protection domain is associated with a source location.private static String
byte[]
transform
(ClassLoader loader, String classname, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.instrument.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:
transform
in 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:
true
if 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:
true
if a source location is defined
-
toVMName
-