ListIterator.
class files represent positions in the code
array of a Code attribute. It is associated with a
bci (bytecode index), also known as pc
(program counter), the index into the code array; the actual cursor
position is immediately before the given index, so a label at the beginning
of the instructions has bci 0, and a label at the end of the
instructions has bci codeLength() + 1. The
bci can be inspected through CodeAttribute::labelToBci.
In generic CodeModels, a label may not have a bci value; the position
of a label can be found by searching for the corresponding LabelTarget
within that model.
java.lang.classfile refer to labels. To write a
label, a label must be obtained, it must be bound to a CodeBuilder.
To obtain a label:
CodeBuilder, such as CodeBuilder::startLabel, CodeBuilder::endLabel, or BlockCodeBuilder::breakLabel. They are already bound.
CodeBuilder::newLabel or
CodeBuilder::newBoundLabel.
A label must be bound exactly once in the CodeBuilder where it is
used; otherwise, writing fails. To bind an unbound label:
LabelTarget to a CodeBuilder.
CodeBuilder::labelBinding.
CodeBuilder; they are separate entities and the label is bound to
different positions in them.
CodeAttribute::labelToBci, CodeBuilder::newLabel, CodeBuilder::labelBinding