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