jacoco core.runtime包源码分析

简介: jacoco core.runtime包源码分析

1 IExecutionDataAccessorGenerator

image.png

被 instrument 的类需要一段代码,该代码从运行时获取 boolean[]实例。

该机制是针对于运行时的,因此由该接口抽象。 实现由 IRuntime 实现提供,并由 instrumentation process过程使用。

唯一方法

  /**
   * 此方法生成获得具有给定id的类的coverage数据结构所需的字节码。 通常,instrumentation 过程会将此代码嵌入到在类初始化时调用的方法中。甚至可以在目标VM外部随时调用此方法。
   *
   * 生成的代码必须将 boolean[] 实例推入操作数栈。 除此结果对象外,生成的代码不得对嵌入方法或类的结构进行任何假设。 生成的代码不得使用或分配局部变量。
   *
   * @param classid
   * @param classname
   *            VM class name
   * @param probecount
   *            probe count for this class
   * @param mv
   *            code output
   * @return additional stack size required by the implementation, including
   *         the instance pushed to the stack
   */
  int generateDataAccessor(long classid, String classname, int probecount,
      MethodVisitor mv);

IRuntime 实现类

package org.jacoco.core.runtime;
/**
 * 此接口表示一种特定的机制,用于在运行时收集目标VM中的执行信息。
 */
public interface IRuntime extends IExecutionDataAccessorGenerator {
  /**
   * start coverage runtime. 
   * This method MUST be called before any class instrumented for this runtime is loaded.
   * 必须在加载为此运行时检测到的任何类之前调用此方法。
   *
   * @param data
   *            the execution data for this runtime
   * @throws Exception
   *             any internal problem during startup
   */
  void startup(RuntimeData data) throws Exception;
  /**
   * Allows the coverage runtime to cleanup internals. This class should be
   * called when classes instrumented for this runtime are not used any more.
   * 允许coverage运行时清理内部。 当不再使用为此运行时检测的类时,应调用该类。
   */
  void shutdown();
}
目录
相关文章
|
2月前
|
Java Maven Windows
java -jar 启动 boot 程序 no main manifest attribute, in .\vipsoft-model-web-0.0.1-SNAPSHOT.jar
java -jar 启动 boot 程序 no main manifest attribute, in .\vipsoft-model-web-0.0.1-SNAPSHOT.jar
53 0
|
12月前
|
Cloud Native Java Go
解决 Spring Boot 和 Gradle Java 版本兼容性问题:A problem occurred configuring root project ‘demo1‘. > Could n
解决 Spring Boot 和 Gradle Java 版本兼容性问题:A problem occurred configuring root project ‘demo1‘. > Could n
821 0
|
5月前
|
Java Maven
idea执行maven打包失败:java.lang.TypeNotPresentException: Type org.springframework.boot.maven.RepackageMojo
idea执行maven打包失败:java.lang.TypeNotPresentException: Type org.springframework.boot.maven.RepackageMojo
231 0
|
XML 存储 Java
maven报错:com.qiniu:qiniu-java-sdk/maven-metadata.xmlfailed to transfer from http://0.0.0.0/
maven报错:com.qiniu:qiniu-java-sdk/maven-metadata.xmlfailed to transfer from http://0.0.0.0/
1904 0
|
存储 Java API
JaCoCo core.internal.flow包源码(下)
JaCoCo core.internal.flow包源码(下)
150 0
JaCoCo core.internal.flow包源码(下)
|
Java 数据库 Android开发
Eclipse的Java build path,可以将一个项目依赖于另外一个项目
Eclipse的Java build path,可以将一个项目依赖于另外一个项目
126 0
Eclipse的Java build path,可以将一个项目依赖于另外一个项目
JaCoCo core.internal.flow包源码(中)
JaCoCo core.internal.flow包源码(中)
106 0
JaCoCo core.internal.flow包源码(上)
JaCoCo core.internal.flow包源码(上)
165 0
下一篇
无影云桌面