mockit.external.asm.LineNumbers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jmockit Show documentation
Show all versions of jmockit Show documentation
JMockit is a Java toolkit for automated developer testing.
It contains APIs for the creation of the objects to be tested, for mocking dependencies, and for faking external
APIs; JUnit (4 & 5) and TestNG test runners are supported.
It also contains an advanced code coverage tool.
package mockit.external.asm;
final class LineNumbers
{
private final ConstantPoolGeneration cp;
/**
* Number of entries in the LineNumberTable attribute.
*/
private int lineNumberCount;
/**
* The LineNumberTable attribute.
*/
private ByteVector lineNumber;
LineNumbers(ConstantPoolGeneration cp) { this.cp = cp; }
void addLineNumber(int line, Label start) {
if (lineNumber == null) {
lineNumber = new ByteVector();
}
lineNumberCount++;
lineNumber.putShort(start.position);
lineNumber.putShort(line);
}
boolean hasLineNumbers() { return lineNumber != null; }
int getSize() { return lineNumber == null ? 0 : 8 + lineNumber.length; }
int getSizeWhileAddingConstantPoolItem() {
if (lineNumber != null) {
cp.newUTF8("LineNumberTable");
}
return getSize();
}
void put(ByteVector out) {
if (lineNumber != null) {
out.putShort(cp.newUTF8("LineNumberTable"));
out.putInt(lineNumber.length + 2).putShort(lineNumberCount);
out.putByteVector(lineNumber);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy