1 /******************************************************************************* 2 * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors 3 * This program and the accompanying materials are made available under 4 * the terms of the Eclipse Public License 2.0 which is available at 5 * http://www.eclipse.org/legal/epl-2.0 6 * 7 * SPDX-License-Identifier: EPL-2.0 8 * 9 * Contributors: 10 * Marc R. Hoffmann - initial API and implementation 11 * 12 *******************************************************************************/ 13 package org.jacoco.core.internal.flow; 14 15 import org.jacoco.core.internal.instr.InstrSupport; 16 import org.objectweb.asm.ClassVisitor; 17 18 /** 19 * A {@link ClassVisitor} with additional methods to get probe insertion 20 * information for each method 21 */ 22 public abstract class ClassProbesVisitor extends ClassVisitor { 23 24 /** 25 * New visitor instance without delegate visitor. 26 */ ClassProbesVisitor()27 public ClassProbesVisitor() { 28 this(null); 29 } 30 31 /** 32 * New visitor instance that delegates to the given visitor. 33 * 34 * @param cv 35 * optional next visitor in chain 36 */ ClassProbesVisitor(final ClassVisitor cv)37 public ClassProbesVisitor(final ClassVisitor cv) { 38 super(InstrSupport.ASM_API_VERSION, cv); 39 } 40 41 /** 42 * When visiting a method we need a {@link MethodProbesVisitor} to handle 43 * the probes of that method. 44 */ 45 @Override visitMethod(int access, String name, String desc, String signature, String[] exceptions)46 public abstract MethodProbesVisitor visitMethod(int access, String name, 47 String desc, String signature, String[] exceptions); 48 49 /** 50 * Reports the total number of encountered probes. For classes this method 51 * is called just before {@link ClassVisitor#visitEnd()}. For interfaces 52 * this method is called before the first method (the static initializer) is 53 * emitted. 54 * 55 * @param count 56 * total number of probes 57 */ visitTotalProbeCount(int count)58 public abstract void visitTotalProbeCount(int count); 59 60 } 61