Class SimpleClassWriter

java.lang.Object
org.objectweb.asm.ClassVisitor
org.objectweb.asm.ClassWriter
com.offbynull.coroutines.instrumenter.asm.SimpleClassWriter

public final class SimpleClassWriter extends org.objectweb.asm.ClassWriter
A ClassWriter that overrides getCommonSuperClass(java.lang.String, java.lang.String) such that it uses ClassInformationRepository to derive the common super rather than querying loaded up classes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     

    Fields inherited from class org.objectweb.asm.ClassWriter

    COMPUTE_FRAMES, COMPUTE_MAXS

    Fields inherited from class org.objectweb.asm.ClassVisitor

    api, cv
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a SimpleClassWriter object.
    SimpleClassWriter(org.objectweb.asm.ClassReader classReader, int flags, ClassInformationRepository infoRepo)
    Constructs a SimpleClassWriter object.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    protected String
    Derives common super class from the super name mapping passed in to the constructor.

    Methods inherited from class org.objectweb.asm.ClassWriter

    getClassLoader, hasFlags, newClass, newConst, newConstantDynamic, newField, newHandle, newHandle, newInvokeDynamic, newMethod, newMethodType, newModule, newNameType, newPackage, newUTF8, setFlags, toByteArray, visit, visitAnnotation, visitAttribute, visitEnd, visitField, visitInnerClass, visitMethod, visitModule, visitNestHost, visitNestMember, visitOuterClass, visitPermittedSubclass, visitRecordComponent, visitSource, visitTypeAnnotation

    Methods inherited from class org.objectweb.asm.ClassVisitor

    getDelegate

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • SimpleClassWriter

      public SimpleClassWriter(int flags, ClassInformationRepository infoRepo)
      Constructs a SimpleClassWriter object. See ClassWriter(int).
      Parameters:
      flags - option flags that can be used to modify the default behavior of this class. See ClassWriter.COMPUTE_MAXS, ClassWriter.COMPUTE_FRAMES.
      infoRepo - class hierarchy mappings for deriving stack map frames
      Throws:
      NullPointerException - if any argument is null
    • SimpleClassWriter

      public SimpleClassWriter(org.objectweb.asm.ClassReader classReader, int flags, ClassInformationRepository infoRepo)
      Constructs a SimpleClassWriter object. See ClassWriter(org.objectweb.asm.ClassReader, int).
      Parameters:
      classReader - the ClassReader used to read the original class. It will be used to copy the entire constant pool from the original class and also to copy other fragments of original bytecode where applicable.
      flags - option flags that can be used to modify the default behavior of this class. See ClassWriter.COMPUTE_MAXS, ClassWriter.COMPUTE_FRAMES.
      infoRepo - class hierarchy mappings for deriving stack map frames
      Throws:
      NullPointerException - if any argument is null
  • Method Details

    • getCommonSuperClass

      protected String getCommonSuperClass(String type1, String type2)
      Derives common super class from the super name mapping passed in to the constructor.
      Overrides:
      getCommonSuperClass in class org.objectweb.asm.ClassWriter
      Parameters:
      type1 - the internal name of a class.
      type2 - the internal name of another class.
      Returns:
      the internal name of the common super class of the two given classes
      Throws:
      NullPointerException - if any argument is null
    • flattenHierarchy

      private LinkedHashSet<String> flattenHierarchy(String type)