jacoco core.runtime包源码分析
        【摘要】     1 IExecutionDataAccessorGenerator 
 被 instrument 的类需要一段代码,该代码从运行时获取 boolean[]实例。 该机制是针对于运行时的,因此由该接口抽象。 实现由 IRuntime 实现提供,并由 instrumentation process过程使用。 
唯一方法 
	/**
	 * 此方法生成获得具有给定id的类的c...
    
    
    
    1 IExecutionDataAccessorGenerator

 被 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);
  
 - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 
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();
}
  
 - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 
文章来源: javaedge.blog.csdn.net,作者:JavaEdge.,版权归原作者所有,如需转载,请联系作者。
原文链接:javaedge.blog.csdn.net/article/details/105264876
        【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
            cloudbbs@huaweicloud.com
        
        
        
        
        - 点赞
 - 收藏
 - 关注作者
 
            
           
评论(0)