Package org.apache.bcel.classfile
Class LineNumber
- java.lang.Object
-
- org.apache.bcel.classfile.LineNumber
-
- All Implemented Interfaces:
java.lang.Cloneable,Node
public final class LineNumber extends java.lang.Object implements java.lang.Cloneable, Node
This class represents a (PC offset, line number) pair, that is, a line number in the source that corresponds to a relative address in the byte code. This is used for debugging purposes.- See Also:
LineNumberTable
-
-
Constructor Summary
Constructors Constructor Description LineNumber(int startPc, int lineNumber)Constructs a LineNumber.LineNumber(LineNumber c)Initialize from another object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor v)Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.LineNumbercopy()Creates a deep copy of this object.voiddump(java.io.DataOutputStream file)Dumps line number/pc pair to file stream in binary format.intgetLineNumber()Gets the line number.intgetStartPC()Gets the program counter.voidsetLineNumber(int lineNumber)Sets the line number.voidsetStartPC(int startPc)Sets the program counter.java.lang.StringtoString()
-
-
-
Constructor Detail
-
LineNumber
public LineNumber(int startPc, int lineNumber)
Constructs a LineNumber.- Parameters:
startPc- Program Counter (PC) corresponds to.lineNumber- line number in source file.
-
LineNumber
public LineNumber(LineNumber c)
Initialize from another object.- Parameters:
c- The object to copy.
-
-
Method Detail
-
accept
public void accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
-
copy
public LineNumber copy()
Creates a deep copy of this object.- Returns:
- deep copy of this object.
-
dump
public void dump(java.io.DataOutputStream file) throws java.io.IOException
Dumps line number/pc pair to file stream in binary format.- Parameters:
file- Output file stream.- Throws:
java.io.IOException- Thrown if an I/O Exception occurs in writeShort.
-
getLineNumber
public int getLineNumber()
Gets the line number.- Returns:
- Corresponding source line.
-
getStartPC
public int getStartPC()
Gets the program counter.- Returns:
- PC in code.
-
setLineNumber
public void setLineNumber(int lineNumber)
Sets the line number.- Parameters:
lineNumber- The source line number.
-
setStartPC
public void setStartPC(int startPc)
Sets the program counter.- Parameters:
startPc- The pc for this line number.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- String representation.
-
-