public class BuildClassMapClassVisitor extends AbstractFindTouchPointsClassInstrumenter
Analyzes given class. Builds ClassMap
that represents any touch-points and other important information
for instrumentation.
ClassVisitor
) does not change the bytecode of the class. It makes only analyzys and fills ClassMap
.Modifier and Type | Field and Description |
---|---|
private ClassMap |
classMap
ClassMap for the currently analyzed class. |
private java.util.Set<java.lang.String> |
ignoredMethods |
private boolean |
toInstrument
It's flag that signals if the class should be instrumented by cobertura.
|
private BuildClassMapTouchPointListener |
touchPointListener
Information about important 'events' (instructions) are sent into the listener that is internally
responsible for modifying the
classMap content. |
duplicatedLinesMap, eventIdGenerator, lineIdGenerator
Constructor and Description |
---|
BuildClassMapClassVisitor(org.objectweb.asm.ClassVisitor cv,
java.util.Collection<java.util.regex.Pattern> ignoreRegexes,
java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> duplicatedLinesMap,
java.util.Set<java.lang.String> ignoredMethods) |
Modifier and Type | Method and Description |
---|---|
ClassMap |
getClassMap()
Returns classMap build for the analyzed map.
|
boolean |
shouldBeInstrumented()
It's flag that signals if the class should be instrumented by Cobertura.
|
void |
visit(int version,
int access,
java.lang.String name,
java.lang.String signature,
java.lang.String parent,
java.lang.String[] interfaces)
Stores in
classMap information of className and if the class should be instrumented (shouldBeInstrumented() ) |
org.objectweb.asm.AnnotationVisitor |
visitAnnotation(java.lang.String name,
boolean arg1) |
org.objectweb.asm.MethodVisitor |
visitMethod(int access,
java.lang.String name,
java.lang.String desc,
java.lang.String signature,
java.lang.String[] exceptions)
Analyzes given method and stores information about all found important places into
classMap |
void |
visitSource(java.lang.String file,
java.lang.String debug)
Stores in
classMap information of source filename |
getIgnoreRegexp, setIgnoreRegexp
private final BuildClassMapTouchPointListener touchPointListener
classMap
content.private boolean toInstrument
shouldBeInstrumented()
.private final java.util.Set<java.lang.String> ignoredMethods
public BuildClassMapClassVisitor(org.objectweb.asm.ClassVisitor cv, java.util.Collection<java.util.regex.Pattern> ignoreRegexes, java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> duplicatedLinesMap, java.util.Set<java.lang.String> ignoredMethods)
cv
- - a listener for code-instrumentation eventsignoreRegexp
- - list of patters of method calls that should be ignored from line-coverage-measurementduplicatedLinesMap
- - map of found duplicates in the class. You should use DetectDuplicatedCodeClassVisitor
to find the duplicated lines.public org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String name, boolean arg1)
visitAnnotation
in class org.objectweb.asm.ClassVisitor
public void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String parent, java.lang.String[] interfaces)
classMap
information of className and if the class should be instrumented (shouldBeInstrumented()
)visit
in class org.objectweb.asm.ClassVisitor
public void visitSource(java.lang.String file, java.lang.String debug)
classMap
information of source filenamevisitSource
in class org.objectweb.asm.ClassVisitor
public org.objectweb.asm.MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
classMap
visitMethod
in class org.objectweb.asm.ClassVisitor
public ClassMap getClassMap()
ClassReader.accept(ClassVisitor, int)
).public boolean shouldBeInstrumented()