Package serp.bytecode

Class Local

    • Constructor Summary

      Constructors 
      Constructor Description
      Local​(LocalTable owner)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.ClassLoader getClassLoader()
      Return the class loader to use when loading related classes.
      Code getCode()
      Returns the Code block that owns the Instruction(s) this InstructionPtr points to.
      Instruction getEnd()
      The last Instruction for which this local is in scope.
      int getLength()
      Get the number of bytes for which this local has a value in the code byte array.
      int getLocal()
      Get the local variable index of the current frame for this local.
      java.lang.String getName()
      Return the name of this local, or null if unset.
      int getNameIndex()
      Return the ConstantPool index of the UTF8Entry that describes the name of this local.
      int getParam()
      Return the parameter that this local corresponds to, or -1 if none.
      ConstantPool getPool()
      Return the constant pool of the current class.
      Project getProject()
      Return the project of the current class.
      Instruction getStart()
      Return the instruction marking the beginning of this local.
      int getStartPc()
      Return the index into the code byte array at which this local starts.
      LocalTable getTable()
      The owning table.
      int getTypeIndex()
      Return the ConstantPool index of the UTF8Entry that describes this local.
      java.lang.String getTypeName()
      Return the full name of the local's type, or null if unset.
      (package private) void invalidate()  
      boolean isValid()
      Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.
      (package private) void read​(java.io.DataInput in)  
      void replaceTarget​(Instruction oldTarget, Instruction newTarget)
      Replace the given old, likely invalid, target with a new target.
      void setEnd​(Instruction end)
      Set the last Instruction for which this local is in scope.
      void setLength​(int length)
      Set the number of bytes for which this local has a value in the code byte array.
      void setLocal​(int index)
      Set the local variable index of the current frame for this local.
      void setName​(java.lang.String name)
      Set the name of this inner local.
      void setNameIndex​(int nameIndex)
      Set the ConstantPool index of the UTF8Entry that describes the name of this local.
      void setParam​(int param)
      Set the method parameter that this local corresponds to.
      void setStart​(Instruction instruction)
      Set the Instruction marking the beginning this local.
      void setStartPc​(int startPc)
      Set the index into the code byte array at which this local starts.
      void setType​(java.lang.String type)
      Set the type of this local.
      void setTypeIndex​(int index)
      Set the ConstantPool index of the UTF8Entry that describes this local.
      void updateTargets()
      Use the byte indexes read from the class file to calculate and set references to the target instruction(s) for this ptr.
      (package private) void write​(java.io.DataOutput out)  
      • Methods inherited from class java.lang.Object

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

      • _length

        private int _length
      • _nameIndex

        private int _nameIndex
      • _descriptorIndex

        private int _descriptorIndex
      • _index

        private int _index
    • Method Detail

      • getTable

        public LocalTable getTable()
        The owning table.
      • invalidate

        void invalidate()
      • getLocal

        public int getLocal()
        Get the local variable index of the current frame for this local.
      • setLocal

        public void setLocal​(int index)
        Set the local variable index of the current frame for this local.
      • getParam

        public int getParam()
        Return the parameter that this local corresponds to, or -1 if none.
      • setParam

        public void setParam​(int param)
        Set the method parameter that this local corresponds to.
      • getStartPc

        public int getStartPc()
        Return the index into the code byte array at which this local starts.
      • getStart

        public Instruction getStart()
        Return the instruction marking the beginning of this local.
      • setStartPc

        public void setStartPc​(int startPc)
        Set the index into the code byte array at which this local starts.
      • setStart

        public void setStart​(Instruction instruction)
        Set the Instruction marking the beginning this local. The instruction must already be a part of the method. WARNING: if this instruction is deleted, the results are undefined.
      • getLength

        public int getLength()
        Get the number of bytes for which this local has a value in the code byte array.
      • setEnd

        public void setEnd​(Instruction end)
        Set the last Instruction for which this local is in scope. The instruction must already be a part of the method. WARNING: if this instruction is deleted, the results are undefined.
      • setLength

        public void setLength​(int length)
        Set the number of bytes for which this local has a value in the code byte array.
      • updateTargets

        public void updateTargets()
        Description copied from interface: InstructionPtr
        Use the byte indexes read from the class file to calculate and set references to the target instruction(s) for this ptr. This method will be called after the byte code has been read in for the first time and before it is written after modification.
        Specified by:
        updateTargets in interface InstructionPtr
      • replaceTarget

        public void replaceTarget​(Instruction oldTarget,
                                  Instruction newTarget)
        Description copied from interface: InstructionPtr
        Replace the given old, likely invalid, target with a new target. The new target Instruction is guaranteed to be in the same code block as this InstructionPtr.
        Specified by:
        replaceTarget in interface InstructionPtr
      • getNameIndex

        public int getNameIndex()
        Return the ConstantPool index of the UTF8Entry that describes the name of this local. Defaults to 0.
      • setNameIndex

        public void setNameIndex​(int nameIndex)
        Set the ConstantPool index of the UTF8Entry that describes the name of this local.
      • getName

        public java.lang.String getName()
        Return the name of this local, or null if unset.
      • setName

        public void setName​(java.lang.String name)
        Set the name of this inner local.
      • getTypeIndex

        public int getTypeIndex()
        Return the ConstantPool index of the UTF8Entry that describes this local. Defaults to 0.
      • setTypeIndex

        public void setTypeIndex​(int index)
        Set the ConstantPool index of the UTF8Entry that describes this local.
      • getTypeName

        public java.lang.String getTypeName()
        Return the full name of the local's type, or null if unset.
      • setType

        public void setType​(java.lang.String type)
        Set the type of this local.
      • getProject

        public Project getProject()
        Description copied from interface: BCEntity
        Return the project of the current class.
        Specified by:
        getProject in interface BCEntity
      • getPool

        public ConstantPool getPool()
        Description copied from interface: BCEntity
        Return the constant pool of the current class.
        Specified by:
        getPool in interface BCEntity
      • getClassLoader

        public java.lang.ClassLoader getClassLoader()
        Description copied from interface: BCEntity
        Return the class loader to use when loading related classes.
        Specified by:
        getClassLoader in interface BCEntity
      • isValid

        public boolean isValid()
        Description copied from interface: BCEntity
        Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.
        Specified by:
        isValid in interface BCEntity
      • read

        void read​(java.io.DataInput in)
           throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        void write​(java.io.DataOutput out)
            throws java.io.IOException
        Throws:
        java.io.IOException
      • getCode

        public Code getCode()
        Description copied from interface: InstructionPtr
        Returns the Code block that owns the Instruction(s) this InstructionPtr points to.
        Specified by:
        getCode in interface InstructionPtr