com.ikokoon.serenity.instrumentation.coverage
Class CoverageMethodAdapter

java.lang.Object
  extended by org.objectweb.asm.MethodAdapter
      extended by com.ikokoon.serenity.instrumentation.coverage.CoverageMethodAdapter
All Implemented Interfaces:
org.objectweb.asm.MethodVisitor

public class CoverageMethodAdapter
extends org.objectweb.asm.MethodAdapter

This class actually enhances the lines to call the collector class which gathers the data on the lines that are executed during the unit tests.

Since:
12.07.09
Version:
01.00
Author:
Michael Couck

Field Summary
 
Fields inherited from class org.objectweb.asm.MethodAdapter
mv
 
Constructor Summary
CoverageMethodAdapter(org.objectweb.asm.MethodVisitor methodVisitor, java.lang.Integer access, java.lang.String className, java.lang.String methodName, java.lang.String methodDescription)
          The constructor initialises a CoverageMethodAdapter that takes all the interesting items for the method that is to be enhanced including the parent method visitor.
 
Method Summary
 void visitLineNumber(int lineNumber, org.objectweb.asm.Label label)
          This is the method that actually adds the instructions to the enhanced class.
 
Methods inherited from class org.objectweb.asm.MethodAdapter
visitAnnotation, visitAnnotationDefault, visitAttribute, visitCode, visitEnd, visitFieldInsn, visitIincInsn, visitInsn, visitIntInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLocalVariable, visitLookupSwitchInsn, visitMaxs, visitMethodInsn, visitMultiANewArrayInsn, visitParameterAnnotation, visitTableSwitchInsn, visitTryCatchBlock, visitTypeInsn, visitVarInsn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoverageMethodAdapter

public CoverageMethodAdapter(org.objectweb.asm.MethodVisitor methodVisitor,
                             java.lang.Integer access,
                             java.lang.String className,
                             java.lang.String methodName,
                             java.lang.String methodDescription)
The constructor initialises a CoverageMethodAdapter that takes all the interesting items for the method that is to be enhanced including the parent method visitor.

Parameters:
methodVisitor - the method visitor of the parent
className - the name of the class the method belongs to
methodName - the name of the method
methodDescription - the description of the method
Method Detail

visitLineNumber

public void visitLineNumber(int lineNumber,
                            org.objectweb.asm.Label label)
This is the method that actually adds the instructions to the enhanced class. It adds an instruction to call a collector class which then collects the data about each line being called. This method puts five strings onto the stack. These are then popped by the call to the collector class and passed as parameters to the collector method.

Specified by:
visitLineNumber in interface org.objectweb.asm.MethodVisitor
Overrides:
visitLineNumber in class org.objectweb.asm.MethodAdapter


Copyright © 2010. All Rights Reserved.