Package org.apache.bcel.generic
Class LineNumberGen
- java.lang.Object
-
- org.apache.bcel.generic.LineNumberGen
-
- All Implemented Interfaces:
java.lang.Cloneable,InstructionTargeter
public class LineNumberGen extends java.lang.Object implements InstructionTargeter, java.lang.Cloneable
This class represents a line number within a method, that is, give an instruction a line number corresponding to the source code line.- See Also:
LineNumber,MethodGen
-
-
Constructor Summary
Constructors Constructor Description LineNumberGen(InstructionHandle ih, int srcLine)Create a line number.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()booleancontainsTarget(InstructionHandle ih)Tests whether this targeter targets the specified instruction handle.InstructionHandlegetInstruction()Gets the instruction handle.LineNumbergetLineNumber()Gets LineNumber attribute.intgetSourceLine()Gets the source line number.voidsetInstruction(InstructionHandle instructionHandle)Sets the instruction handle.voidsetSourceLine(int srcLine)Sets the source line number.voidupdateTarget(InstructionHandle oldIh, InstructionHandle newIh)Replaces the target of this targeter from this old handle to the new handle.
-
-
-
Constructor Detail
-
LineNumberGen
public LineNumberGen(InstructionHandle ih, int srcLine)
Create a line number.- Parameters:
ih- instruction handle to reference.srcLine- source line number.
-
-
Method Detail
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
containsTarget
public boolean containsTarget(InstructionHandle ih)
Description copied from interface:InstructionTargeterTests whether this targeter targets the specified instruction handle.- Specified by:
containsTargetin interfaceInstructionTargeter- Parameters:
ih- The instruction handle to test.- Returns:
- true, if ih is target of this line number.
-
getInstruction
public InstructionHandle getInstruction()
Gets the instruction handle.- Returns:
- The instruction handle.
-
getLineNumber
public LineNumber getLineNumber()
Gets LineNumber attribute. This relies on that the instruction list has already been dumped to byte code or that the 'setPositions' methods has been called for the instruction list.- Returns:
- The line number attribute.
-
getSourceLine
public int getSourceLine()
Gets the source line number.- Returns:
- The source line number.
-
setInstruction
public void setInstruction(InstructionHandle instructionHandle)
Sets the instruction handle.- Parameters:
instructionHandle- The instruction handle to set.
-
setSourceLine
public void setSourceLine(int srcLine)
Sets the source line number.- Parameters:
srcLine- The source line number to set.
-
updateTarget
public void updateTarget(InstructionHandle oldIh, InstructionHandle newIh)
Description copied from interface:InstructionTargeterReplaces the target of this targeter from this old handle to the new handle.- Specified by:
updateTargetin interfaceInstructionTargeter- Parameters:
oldIh- old target.newIh- new target.
-
-