Package serp.bytecode
Class LineNumber
java.lang.Object
serp.bytecode.LineNumber
- All Implemented Interfaces:
Comparable,BCEntity,InstructionPtr,VisitAcceptor
public class LineNumber
extends Object
implements 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
Modifier and TypeMethodDescriptionvoidacceptVisit(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.intReturn the class loader to use when loading related classes.getCode()Returns the Code block that owns the Instruction(s) this InstructionPtr points to.intgetLine()Return source line number.getPool()Return the constant pool of the current class.Return the project of the current class.getStart()Return the instruction marking the beginning of this line.intReturn the index into the code byte array at which this line starts.getTable()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.voidUse the byte indexes read from the class file to calculate and set references to the target instruction(s) for this ptr.
-
Method Details
-
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
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
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
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
Description copied from interface:BCEntityReturn the project of the current class.- Specified by:
getProjectin interfaceBCEntity
-
getPool
Description copied from interface:BCEntityReturn the constant pool of the current class. -
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
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
- Specified by:
compareToin interfaceComparable
-
getCode
Description copied from interface:InstructionPtrReturns the Code block that owns the Instruction(s) this InstructionPtr points to.- Specified by:
getCodein interfaceInstructionPtr
-