Class LabelImpl

All Implemented Interfaces:
ClassFileElement, CodeElement, LabelTarget, Label, PseudoInstruction

public final class LabelImpl extends AbstractElement implements Label, LabelTarget
Labels are created with a parent context, which is either a code attribute or a code builder. A label originating in a code attribute context may be reused in a code builder context, but only labels from a single code attribute may be reused by a single code builder. Mappings to and from BCI are the responsibility of the context in which it is used; a single word of mutable state is provided, for the exclusive use of the owning context. In practice, this means that labels created in a code attribute can simply store the BCI in the state on creation, and labels created in in a code builder can store the BCI in the state when the label is eventually set; if a code attribute label is reused in a builder, the original BCI can be used as an index into an array.
  • Constructor Details

    • LabelImpl

      public LabelImpl(LabelContext labelContext, int bci)
  • Method Details

    • labelContext

      public LabelContext labelContext()
    • getBCI

      public int getBCI()
    • setBCI

      public void setBCI(int bci)
    • label

      public Label label()
      Description copied from interface: LabelTarget
      Returns the label corresponding to this target.
      Specified by:
      label in interface LabelTarget
      Returns:
      the label corresponding to this target
    • writeTo

      public void writeTo(DirectCodeBuilder builder)
      Overrides:
      writeTo in class AbstractElement
    • toString

      public String toString()
      Overrides:
      toString in class Object