public sealed interface Label
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.
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/Label.html