Label (Java SE 22 & JDK 22)
Description: declaration: module: java.base, package: java.lang.classfile, interface: Label
Keywords: java.lang.classfile.Label interface

Module java.base
Package java.lang.classfilePREVIEW

# Interface Label

public sealed interface Label
`Label` is a preview API of the Java platform.
Programs can only use `Label` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A marker for a position within the instructions of a method body. The association between a label's identity and the position it represents is managed by the entity managing the method body (a `CodeModel`PREVIEW or `CodeBuilder`PREVIEW), not the label itself; this allows the same label to have a meaning both in an existing method (as managed by a CodeModelPREVIEW) and in the transformation of that method (as managed by a CodeBuilderPREVIEW), while corresponding to different positions in each. When traversing the elements of a CodeModelPREVIEW, LabelPREVIEW markers will be delivered at the position to which they correspond. A label can be bound to the current position within a CodeBuilderPREVIEW via `CodeBuilder.labelBinding(Label)`PREVIEW or `ClassFileBuilder.with(ClassFileElement)`PREVIEW.

Since:
  22