Class Initialiser


  • public class Initialiser
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Initialiser.InjectionMode
      Strategy for injecting initialiser insns
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static int[] OPCODE_BLACKLIST
      List of opcodes which must not appear in a class initialiser, mainly a sanity check so that if any of the specified opcodes are found, we can log it as an error condition and then people can bitch at me to fix it.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.objectweb.asm.tree.MethodNode getCtor()
      Get the source constructor
      java.util.Deque<org.objectweb.asm.tree.AbstractInsnNode> getInsns()
      Get the extracted instructions
      int getMaxStack()
      Get the MAXS for the original (source) constructor
      void injectInto​(Constructor ctor)
      Inject initialiser code into the target constructor
      int size()
      Get the number of instructions in the extracted initialiser
      • Methods inherited from class java.lang.Object

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

      • OPCODE_BLACKLIST

        protected static final int[] OPCODE_BLACKLIST
        List of opcodes which must not appear in a class initialiser, mainly a sanity check so that if any of the specified opcodes are found, we can log it as an error condition and then people can bitch at me to fix it. Essentially if it turns out that field initialisers can somehow make use of local variables, then I need to write some code to ensure that said locals are shifted so that they don't interfere with locals in the receiving constructor.
    • Method Detail

      • size

        public int size()
        Get the number of instructions in the extracted initialiser
      • getMaxStack

        public int getMaxStack()
        Get the MAXS for the original (source) constructor
      • getCtor

        public org.objectweb.asm.tree.MethodNode getCtor()
        Get the source constructor
      • getInsns

        public java.util.Deque<org.objectweb.asm.tree.AbstractInsnNode> getInsns()
        Get the extracted instructions
      • injectInto

        public void injectInto​(Constructor ctor)
        Inject initialiser code into the target constructor
        Parameters:
        ctor - Constructor to inject into