Interface CodeBuilder.BlockCodeBuilder

All Superinterfaces:
ClassFileBuilder<CodeElement,CodeBuilder>, CodeBuilder, Consumer<CodeElement>
Enclosing interface:
CodeBuilder

public static sealed interface CodeBuilder.BlockCodeBuilder extends CodeBuilder
A builder for blocks of code. Its CodeBuilder.startLabel() and CodeBuilder.endLabel() do not enclose the entire method body, but from the start to the end of the block.

The location where a block of code merges back to its parent block, as represented by the breakLabel(), is expected to be reachable, either from this block or the parent block. The built code may be malformed if there is no executable code at that location.

Since:
24
  • Method Details

    • breakLabel

      Label breakLabel()
      Returns the label locating where control is passed back to the parent block. A branch to this label "break"'s out of the current block.

      If the last instruction in this block does not lead to the break label, Class-File API may append instructions to target the "break" label to the built block.

      Returns:
      the label locating where control is passed back to the parent block