org.jacoco.core.instr
Class MethodInstrumenter

java.lang.Object
  extended by org.objectweb.asm.MethodAdapter
      extended by org.objectweb.asm.commons.LocalVariablesSorter
          extended by org.objectweb.asm.commons.GeneratorAdapter
              extended by org.jacoco.core.instr.MethodInstrumenter
All Implemented Interfaces:
IBlockMethodVisitor, MethodVisitor

public class MethodInstrumenter
extends GeneratorAdapter
implements IBlockMethodVisitor

This method adapter instruments a method to record every block that gets fully executed.

Version:
$Revision: $
Author:
Marc R. Hoffmann

Field Summary
 
Fields inherited from class org.objectweb.asm.commons.GeneratorAdapter
ADD, AND, DIV, EQ, GE, GT, LE, LT, MUL, NE, NEG, OR, REM, SHL, SHR, SUB, USHR, XOR
 
Fields inherited from class org.objectweb.asm.commons.LocalVariablesSorter
firstLocal, nextLocal
 
Fields inherited from class org.objectweb.asm.MethodAdapter
mv
 
Constructor Summary
MethodInstrumenter(MethodVisitor mv, int access, String name, String desc, String enclosingType)
          Create a new instrumenter instance for the given method.
 
Method Summary
 void visitBlockEnd(int id)
          This method is always called after the last instruction of a block.
 void visitBlockEndBeforeJump(int id)
          This method is called at the end of a block.
 void visitCode()
           
 void visitMaxs(int maxStack, int maxLocals)
           
 
Methods inherited from class org.objectweb.asm.commons.GeneratorAdapter
arrayLength, arrayLoad, arrayStore, box, cast, catchException, checkCast, dup, dup2, dup2X1, dup2X2, dupX1, dupX2, endMethod, getField, getLocalType, getStatic, goTo, ifCmp, ifICmp, ifNonNull, ifNull, ifZCmp, iinc, instanceOf, invokeConstructor, invokeInterface, invokeStatic, invokeVirtual, loadArg, loadArgArray, loadArgs, loadArgs, loadLocal, loadLocal, loadThis, mark, mark, math, monitorEnter, monitorExit, newArray, newInstance, newLabel, not, pop, pop2, push, push, push, push, push, push, push, putField, putStatic, ret, returnValue, setLocalType, storeArg, storeLocal, storeLocal, swap, swap, tableSwitch, tableSwitch, throwException, throwException, unbox
 
Methods inherited from class org.objectweb.asm.commons.LocalVariablesSorter
newLocal, newLocalMapping, visitFrame, visitIincInsn, visitLocalVariable, visitVarInsn
 
Methods inherited from class org.objectweb.asm.MethodAdapter
visitAnnotation, visitAnnotationDefault, visitAttribute, visitEnd, visitFieldInsn, visitInsn, visitIntInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLookupSwitchInsn, visitMethodInsn, visitMultiANewArrayInsn, visitParameterAnnotation, visitTableSwitchInsn, visitTryCatchBlock, visitTypeInsn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.asm.MethodVisitor
visitAnnotation, visitAnnotationDefault, visitAttribute, visitEnd, visitFieldInsn, visitFrame, visitIincInsn, visitInsn, visitIntInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLookupSwitchInsn, visitMethodInsn, visitMultiANewArrayInsn, visitParameterAnnotation, visitTableSwitchInsn, visitTryCatchBlock, visitTypeInsn, visitVarInsn
 

Constructor Detail

MethodInstrumenter

public MethodInstrumenter(MethodVisitor mv,
                          int access,
                          String name,
                          String desc,
                          String enclosingType)
Create a new instrumenter instance for the given method.

Parameters:
mv - next method visitor in the chain
access - access flags for the method
name - name of the method
desc - description of the method
enclosingType - type enclosing this method
Method Detail

visitCode

public void visitCode()
Specified by:
visitCode in interface MethodVisitor
Overrides:
visitCode in class MethodAdapter

visitMaxs

public void visitMaxs(int maxStack,
                      int maxLocals)
Specified by:
visitMaxs in interface MethodVisitor
Overrides:
visitMaxs in class LocalVariablesSorter

visitBlockEndBeforeJump

public void visitBlockEndBeforeJump(int id)
Description copied from interface: IBlockMethodVisitor
This method is called at the end of a block. If the last instruction of the block may interrupt the control flow (e.g. jump or return) this method is called right before this statement is visited.

Specified by:
visitBlockEndBeforeJump in interface IBlockMethodVisitor
Parameters:
id - identifier of the block within the method

visitBlockEnd

public void visitBlockEnd(int id)
Description copied from interface: IBlockMethodVisitor
This method is always called after the last instruction of a block.

Specified by:
visitBlockEnd in interface IBlockMethodVisitor
Parameters:
id - identifier of the block within the method