CodeBuilder.BlockCodeBuilder (Java SE 23 & JDK 23)
Description: declaration: module: java.base, package: java.lang.classfile, interface: CodeBuilder, interface: BlockCodeBuilder
Keywords: java.lang.classfile.CodeBuilder.BlockCodeBuilder interface

# Interface CodeBuilder.BlockCodeBuilder

All Superinterfaces:
  `ClassFileBuilderPREVIEW<CodeElementPREVIEW,CodeBuilderPREVIEW>`, `CodeBuilderPREVIEW`, `Consumer<CodeElementPREVIEW>`

Enclosing interface:
  `CodeBuilderPREVIEW`

public static sealed interface CodeBuilder.BlockCodeBuilder extends CodeBuilderPREVIEW
`BlockCodeBuilder` is a preview API of the Java platform.
Programs can only use `BlockCodeBuilder` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A builder for blocks of code.

Since:
  22

- ## Nested Class Summary

  ### Nested classes/interfaces declared in interface java.lang.classfile.CodeBuilderPREVIEW

  `CodeBuilder.BlockCodeBuilderPREVIEW, CodeBuilder.CatchBuilderPREVIEW`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `LabelPREVIEW`
  `breakLabel()`
  Returns the label locating where control is passed back to the parent block..

  ### Methods declared in interface java.lang.classfile.ClassFileBuilderPREVIEW

  `accept, canWriteDirect, constantPool, transform, with`

  ### Methods declared in interface java.lang.classfile.CodeBuilderPREVIEW

  `aaload, aastore, aconst_null, allocateLocal, aload, anewarray, anewarray, areturn, arraylength, arrayLoad, arrayStore, astore, athrow, baload, bastore, bipush, block, branch, caload, castore, characterRange, checkcast, checkcast, conversion, d2f, d2i, d2l, dadd, daload, dastore, dcmpg, dcmpl, dconst_0, dconst_1, ddiv, dload, dmul, dneg, drem, dreturn, dstore, dsub, dup, dup_x1, dup_x2, dup2, dup2_x1, dup2_x2, endLabel, exceptionCatch, exceptionCatch, exceptionCatch, exceptionCatchAll, f2d, f2i, f2l, fadd, faload, fastore, fcmpg, fcmpl, fconst_0, fconst_1, fconst_2, fdiv, fieldAccess, fieldAccess, fload, fmul, fneg, frem, freturn, fstore, fsub, getfield, getfield, getstatic, getstatic, goto_, goto_w, i2b, i2c, i2d, i2f, i2l, i2s, iadd, iaload, iand, iastore, iconst_0, iconst_1, iconst_2, iconst_3, iconst_4, iconst_5, iconst_m1, idiv, if_acmpeq, if_acmpne, if_icmpeq, if_icmpge, if_icmpgt, if_icmple, if_icmplt, if_icmpne, if_nonnull, if_null, ifeq, ifge, ifgt, ifle, iflt, ifne, ifThen, ifThen, ifThenElse, ifThenElse, iinc, iload, imul, ineg, instanceOf, instanceOf, invoke, invoke, invokedynamic, invokedynamic, invokeinterface, invokeinterface, invokespecial, invokespecial, invokespecial, invokespecial, invokestatic, invokestatic, invokestatic, invokestatic, invokevirtual, invokevirtual, ior, irem, ireturn, ishl, ishr, istore, isub, iushr, ixor, l2d, l2f, l2i, labelBinding, ladd, laload, land, lastore, lcmp, lconst_0, lconst_1, ldc, ldc, ldiv, lineNumber, lload, lmul, lneg, loadConstant, loadConstant, loadLocal, localVariable, localVariable, localVariableType, localVariableType, lookupswitch, lor, lrem, lreturn, lshl, lshr, lstore, lsub, lushr, lxor, monitorenter, monitorexit, multianewarray, multianewarray, new_, new_, newarray, newBoundLabel, newLabel, nop, original, parameterSlot, pop, pop2, putfield, putfield, putstatic, putstatic, receiverSlot, return_, return_, saload, sastore, sipush, startLabel, storeLocal, swap, tableswitch, tableswitch, transforming, trying`

  ### Methods declared in interface java.util.function.Consumer

  `andThen`

- ## Method Details

  - ### breakLabel

    LabelPREVIEW 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 an instruction occurring immediately after the built block's last instruction would be reachable from that last instruction, then a gotoPREVIEW instruction targeting the "break" label is appended to the built block.

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