Package serp.bytecode
Class LineNumber
- java.lang.Object
-
- serp.bytecode.LineNumber
-
- All Implemented Interfaces:
java.lang.Comparable,BCEntity,InstructionPtr,VisitAcceptor
public class LineNumber extends java.lang.Object implements java.lang.Comparable, InstructionPtr, BCEntity, VisitAcceptor
A line number corresponds to a sequence of opcodes that map logically to a line of source code.- Author:
- Abe White
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptVisit(BCVisitor visit)Accept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.intcompareTo(java.lang.Object other)java.lang.ClassLoadergetClassLoader()Return the class loader to use when loading related classes.CodegetCode()Returns the Code block that owns the Instruction(s) this InstructionPtr points to.intgetLine()Return source line number.ConstantPoolgetPool()Return the constant pool of the current class.ProjectgetProject()Return the project of the current class.InstructiongetStart()Return the instruction marking the beginning of this line.intgetStartPc()Return the index into the code byte array at which this line starts.LineNumberTablegetTable()Line numbers are stored in aLineNumberTable.booleanisValid()Return false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.voidreplaceTarget(Instruction oldTarget, Instruction newTarget)Replace the given old, likely invalid, target with a new target.voidsetLine(int lineNumber)Set the source line number.voidsetStart(Instruction instruction)Set theInstructionmarking the beginning this line.voidsetStartPc(int startPc)Set the index into the code byte array at which this line starts.voidupdateTargets()Use the byte indexes read from the class file to calculate and set references to the target instruction(s) for this ptr.
-
-
-
Method Detail
-
getTable
public LineNumberTable getTable()
Line numbers are stored in aLineNumberTable.
-
getLine
public int getLine()
Return source line number.
-
setLine
public void setLine(int lineNumber)
Set the source line number.
-
getStart
public Instruction getStart()
Return the instruction marking the beginning of this line.
-
getStartPc
public int getStartPc()
Return the index into the code byte array at which this line starts.
-
setStartPc
public void setStartPc(int startPc)
Set the index into the code byte array at which this line starts.
-
setStart
public void setStart(Instruction instruction)
Set theInstructionmarking the beginning this line. The instruction must already be a part of the method.
-
updateTargets
public void updateTargets()
Description copied from interface:InstructionPtrUse 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:
updateTargetsin interfaceInstructionPtr
-
replaceTarget
public void replaceTarget(Instruction oldTarget, Instruction newTarget)
Description copied from interface:InstructionPtrReplace 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:
replaceTargetin interfaceInstructionPtr
-
getProject
public Project getProject()
Description copied from interface:BCEntityReturn the project of the current class.- Specified by:
getProjectin interfaceBCEntity
-
getPool
public ConstantPool getPool()
Description copied from interface:BCEntityReturn the constant pool of the current class.
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:BCEntityReturn the class loader to use when loading related classes.- Specified by:
getClassLoaderin interfaceBCEntity
-
isValid
public boolean isValid()
Description copied from interface:BCEntityReturn false if this entity has been removed from its parent; in this case the results of any operations on the entity are undefined.
-
acceptVisit
public void acceptVisit(BCVisitor visit)
Description copied from interface:VisitAcceptorAccept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.- Specified by:
acceptVisitin interfaceVisitAcceptor
-
compareTo
public int compareTo(java.lang.Object other)
- Specified by:
compareToin interfacejava.lang.Comparable
-
getCode
public Code getCode()
Description copied from interface:InstructionPtrReturns the Code block that owns the Instruction(s) this InstructionPtr points to.- Specified by:
getCodein interfaceInstructionPtr
-
-