Class MethodRecorder

java.lang.Object
org.objectweb.asm.ClassVisitor
org.checkerframework.afu.scenelib.util.MethodRecorder

public class MethodRecorder extends org.objectweb.asm.ClassVisitor
A MethodRecorder is a ClassVisitor which simply keeps track of the methods, fields and declaration annotations inside a class. The main use of this class is to get this information in the order it is visited by ClassWriter, which is the order in which they occur in the classfile.
  • Field Summary

    Fields inherited from class org.objectweb.asm.ClassVisitor

    api, cv
  • Constructor Summary

    Constructors
    Constructor
    Description
    MethodRecorder(int api)
    Construct a new MethodRecorder.
    MethodRecorder(int api, org.objectweb.asm.ClassVisitor classVisitor)
    Construct a new MethodRecorder.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the declaration annotations in the class in the order that they occur in the classfile.
    Returns the fields in the class in the order that they occur in the classfile.
    Returns the methods in the class in the order that they occur in the classfile.
    static void
    main(String[] args)
    (Used for testing.)
    org.objectweb.asm.AnnotationVisitor
    visitAnnotation(String descriptor, boolean visible)
     
    org.objectweb.asm.FieldVisitor
    visitField(int access, String name, String descriptor, String signature, Object value)
     
    org.objectweb.asm.MethodVisitor
    visitMethod(int access, String name, String descriptor, String signature, String[] exceptions)
     

    Methods inherited from class org.objectweb.asm.ClassVisitor

    getDelegate, visit, visitAttribute, visitEnd, visitInnerClass, visitModule, visitNestHost, visitNestMember, visitOuterClass, visitPermittedSubclass, visitRecordComponent, visitSource, visitTypeAnnotation

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MethodRecorder

      public MethodRecorder(int api)
      Construct a new MethodRecorder.
      Parameters:
      api - version of ASM api to use
    • MethodRecorder

      public MethodRecorder(int api, org.objectweb.asm.ClassVisitor classVisitor)
      Construct a new MethodRecorder.
      Parameters:
      api - version of ASM api to use
      classVisitor - ClassVisitor to use
  • Method Details

    • visitMethod

      public org.objectweb.asm.MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions)
      Overrides:
      visitMethod in class org.objectweb.asm.ClassVisitor
    • visitAnnotation

      public org.objectweb.asm.AnnotationVisitor visitAnnotation(String descriptor, boolean visible)
      Overrides:
      visitAnnotation in class org.objectweb.asm.ClassVisitor
    • getMethods

      public List<String> getMethods()
      Returns the methods in the class in the order that they occur in the classfile.
      Returns:
      list containing names of methods in the class
    • getAnnotations

      public List<String> getAnnotations()
      Returns the declaration annotations in the class in the order that they occur in the classfile.
      Returns:
      list containing names of declaration annotations in the class
    • getFields

      public List<String> getFields()
      Returns the fields in the class in the order that they occur in the classfile.
      Returns:
      list containing names of fields in the class
    • visitField

      public org.objectweb.asm.FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value)
      Overrides:
      visitField in class org.objectweb.asm.ClassVisitor
    • main

      public static void main(String[] args) throws IOException
      (Used for testing.)
      Parameters:
      args - input arguments
      Throws:
      IOException - if a problem occurs during ClassReader construction