Class OfflineInstrumentationAccessGenerator

java.lang.Object
org.jacoco.core.runtime.OfflineInstrumentationAccessGenerator
All Implemented Interfaces:
IExecutionDataAccessorGenerator

public class OfflineInstrumentationAccessGenerator extends Object implements IExecutionDataAccessorGenerator
This implementation of IExecutionDataAccessorGenerator generate a direct dependency to the JaCoCo runtime agent to initialize the runtime and obtain probe arrays. This generator is designed for offline instrumentation only.
  • Field Details

    • runtimeClassName

      private final String runtimeClassName
  • Constructor Details

    • OfflineInstrumentationAccessGenerator

      public OfflineInstrumentationAccessGenerator()
      Creates a new instance for offline instrumentation.
    • OfflineInstrumentationAccessGenerator

      OfflineInstrumentationAccessGenerator(String runtimeClassName)
      Creates a new instance with the given runtime class name for testing purposes
      Parameters:
      runtimeClassName - VM name of the runtime class
  • Method Details

    • generateDataAccessor

      public int generateDataAccessor(long classid, String classname, int probecount, org.objectweb.asm.MethodVisitor mv)
      Description copied from interface: IExecutionDataAccessorGenerator
      This method generates the byte code required to obtain the coverage data structure for the class with the given id. Typically the instrumentation process will embed this code into a method that is called on class initialization. This method can be called at any time even outside the target VM. The generated code must push a boolean[] instance to the operand stack. Except this result object the generated code must not make any assumptions about the structure of the embedding method or class. The generated code must not use or allocate local variables.
      Specified by:
      generateDataAccessor in interface IExecutionDataAccessorGenerator
      Parameters:
      classid - identifier of the class
      classname - VM class name
      probecount - probe count for this class
      mv - code output
      Returns:
      additional stack size required by the implementation, including the instance pushed to the stack