IProbeArrayStrategy.java revision 66aa380fc544f5646d507ad8cc8ce539866f005c
1/******************************************************************************* 2 * Copyright (c) 2009, 2011 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.instr; 13 14import org.objectweb.asm.ClassVisitor; 15import org.objectweb.asm.MethodVisitor; 16 17/** 18 * Strategies to retrieve the probe array instance for each method within a 19 * type. This abstraction is required as we need to follow a different strategy 20 * depending on whether the instrumented type is a class or interface. 21 */ 22interface IProbeArrayStrategy { 23 24 /** 25 * Creates code that pushes the probe array instance on the operand stack. 26 * 27 * @param mv 28 * visitor to create code 29 * @return maximum stack size required by the generated code 30 */ 31 int pushInstance(MethodVisitor mv); 32 33 /** 34 * Adds additional class members required by this strategy. 35 * 36 * @param delegate 37 * visitor to create fields and classes 38 */ 39 void addMembers(ClassVisitor delegate); 40 41} 42