org.jacoco.core.instr
Class MethodAnalyzer

java.lang.Object
  extended by org.jacoco.core.instr.MethodAnalyzer
All Implemented Interfaces:
IBlockMethodVisitor, MethodVisitor

public final class MethodAnalyzer
extends Object
implements IBlockMethodVisitor

This IBlockMethodVisitor analyzes the block structure of a method and reports it to a IMethodStructureVisitor instance.

Version:
$Revision: $
Author:
Marc R. Hoffmann

Constructor Summary
MethodAnalyzer(IMethodStructureVisitor structureVisitor)
          Creates a new analyzer that reports to the given IMethodStructureVisitor instance.
 
Method Summary
 AnnotationVisitor visitAnnotation(String desc, boolean visible)
           
 AnnotationVisitor visitAnnotationDefault()
           
 void visitAttribute(Attribute attr)
           
 void visitBlockEnd(int id)
          This method is always called after the last instruction of a block.
 void visitBlockEndBeforeJump(int id)
          This method is called at the end of a block.
 void visitCode()
           
 void visitEnd()
           
 void visitFieldInsn(int opcode, String owner, String name, String desc)
           
 void visitFrame(int type, int local, Object[] local2, int stack, Object[] stack2)
           
 void visitIincInsn(int var, int increment)
           
 void visitInsn(int opcode)
           
 void visitIntInsn(int opcode, int operand)
           
 void visitJumpInsn(int opcode, Label label)
           
 void visitLabel(Label label)
           
 void visitLdcInsn(Object cst)
           
 void visitLineNumber(int line, Label start)
           
 void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index)
           
 void visitLookupSwitchInsn(Label dflt, int[] keys, Label[] labels)
           
 void visitMaxs(int maxStack, int maxLocals)
           
 void visitMethodInsn(int opcode, String owner, String name, String desc)
           
 void visitMultiANewArrayInsn(String desc, int dims)
           
 AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible)
           
 void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels)
           
 void visitTryCatchBlock(Label start, Label end, Label handler, String type)
           
 void visitTypeInsn(int opcode, String type)
           
 void visitVarInsn(int opcode, int var)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodAnalyzer

public MethodAnalyzer(IMethodStructureVisitor structureVisitor)
Creates a new analyzer that reports to the given IMethodStructureVisitor instance.

Parameters:
structureVisitor - consumer for method structure events
Method Detail

visitAnnotation

public AnnotationVisitor visitAnnotation(String desc,
                                         boolean visible)
Specified by:
visitAnnotation in interface MethodVisitor

visitAnnotationDefault

public AnnotationVisitor visitAnnotationDefault()
Specified by:
visitAnnotationDefault in interface MethodVisitor

visitParameterAnnotation

public AnnotationVisitor visitParameterAnnotation(int parameter,
                                                  String desc,
                                                  boolean visible)
Specified by:
visitParameterAnnotation in interface MethodVisitor

visitAttribute

public void visitAttribute(Attribute attr)
Specified by:
visitAttribute in interface MethodVisitor

visitCode

public void visitCode()
Specified by:
visitCode in interface MethodVisitor

visitFrame

public void visitFrame(int type,
                       int local,
                       Object[] local2,
                       int stack,
                       Object[] stack2)
Specified by:
visitFrame in interface MethodVisitor

visitLabel

public void visitLabel(Label label)
Specified by:
visitLabel in interface MethodVisitor

visitLocalVariable

public void visitLocalVariable(String name,
                               String desc,
                               String signature,
                               Label start,
                               Label end,
                               int index)
Specified by:
visitLocalVariable in interface MethodVisitor

visitTryCatchBlock

public void visitTryCatchBlock(Label start,
                               Label end,
                               Label handler,
                               String type)
Specified by:
visitTryCatchBlock in interface MethodVisitor

visitMaxs

public void visitMaxs(int maxStack,
                      int maxLocals)
Specified by:
visitMaxs in interface MethodVisitor

visitLineNumber

public void visitLineNumber(int line,
                            Label start)
Specified by:
visitLineNumber in interface MethodVisitor

visitInsn

public void visitInsn(int opcode)
Specified by:
visitInsn in interface MethodVisitor

visitJumpInsn

public void visitJumpInsn(int opcode,
                          Label label)
Specified by:
visitJumpInsn in interface MethodVisitor

visitFieldInsn

public void visitFieldInsn(int opcode,
                           String owner,
                           String name,
                           String desc)
Specified by:
visitFieldInsn in interface MethodVisitor

visitIincInsn

public void visitIincInsn(int var,
                          int increment)
Specified by:
visitIincInsn in interface MethodVisitor

visitIntInsn

public void visitIntInsn(int opcode,
                         int operand)
Specified by:
visitIntInsn in interface MethodVisitor

visitLdcInsn

public void visitLdcInsn(Object cst)
Specified by:
visitLdcInsn in interface MethodVisitor

visitLookupSwitchInsn

public void visitLookupSwitchInsn(Label dflt,
                                  int[] keys,
                                  Label[] labels)
Specified by:
visitLookupSwitchInsn in interface MethodVisitor

visitMethodInsn

public void visitMethodInsn(int opcode,
                            String owner,
                            String name,
                            String desc)
Specified by:
visitMethodInsn in interface MethodVisitor

visitMultiANewArrayInsn

public void visitMultiANewArrayInsn(String desc,
                                    int dims)
Specified by:
visitMultiANewArrayInsn in interface MethodVisitor

visitTableSwitchInsn

public void visitTableSwitchInsn(int min,
                                 int max,
                                 Label dflt,
                                 Label[] labels)
Specified by:
visitTableSwitchInsn in interface MethodVisitor

visitTypeInsn

public void visitTypeInsn(int opcode,
                          String type)
Specified by:
visitTypeInsn in interface MethodVisitor

visitVarInsn

public void visitVarInsn(int opcode,
                         int var)
Specified by:
visitVarInsn in interface MethodVisitor

visitEnd

public void visitEnd()
Specified by:
visitEnd in interface MethodVisitor

visitBlockEndBeforeJump

public void visitBlockEndBeforeJump(int id)
Description copied from interface: IBlockMethodVisitor
This method is called at the end of a block. If the last instruction of the block may interrupt the control flow (e.g. jump or return) this method is called right before this statement is visited.

Specified by:
visitBlockEndBeforeJump in interface IBlockMethodVisitor
Parameters:
id - identifier of the block within the method

visitBlockEnd

public void visitBlockEnd(int id)
Description copied from interface: IBlockMethodVisitor
This method is always called after the last instruction of a block.

Specified by:
visitBlockEnd in interface IBlockMethodVisitor
Parameters:
id - identifier of the block within the method