Module java.base
Package java.lang.classfile

# Interface CodeBuilder.CatchBuilder

≠
public abstract static sealed interface CatchBuilder
permits jdk.internal.classfile.impl.CatchBuilderImpl
Comparing master and cf

Enclosing interface:
  `CodeBuilder`

public static sealed interface CodeBuilder.CatchBuilder
A builder to add catch blocks.

Since:
  24
See Also:
  - `CodeBuilder.trying(Consumer, Consumer)`
  - `ExceptionCatch`

## Methods

- ≠
  public abstract java.lang.classfile.CodeBuilder.CatchBuilder catching(java.lang.constant.ClassDesc arg0, java.util.function.Consumer<java.lang.classfile.CodeBuilder.BlockCodeBuilder> arg1)
  Comparing master and cf

  ### catching

  CodeBuilder.CatchBuilder catching (ClassDesc exceptionType, Consumer<CodeBuilder.BlockCodeBuilder> catchHandler)
  Adds a catch block that catches an exception of the given type.

  The caught exception will be on top of the operand stack when the catch block is entered.

  The `CodeBuilder.BlockCodeBuilder.breakLabel()` for the catch block corresponds to the break label of the `tryHandler` block in `CodeBuilder.trying(Consumer, Consumer)` .

  If the type of exception is `null` then the catch block catches all exceptions.

  Parameters:
    `exceptionType` - the type of exception to catch., may be `null`
    `catchHandler` - handler that receives a `Moved out of a link with destination CodeBuilder.html with title interface in java.lang.classfile.Moved to a link with destination CodeBuilder.BlockCodeBuilder.html with title interface in java.lang.classfile.Moved to a computer code block.CodeBuilder.BlockCodeBuilder` to generate the body of the catch block.
  Returns:
    this builder
  Throws:
    `IllegalArgumentException` - if an existing catch block catches an exception of the given type or `exceptionType` represents a primitive type
  See Also:
    - `catchingMulti(List, Consumer)`
    - `catchingAll(Consumer)`
- ≠
  public abstract void catchingAll(java.util.function.Consumer<java.lang.classfile.CodeBuilder.BlockCodeBuilder> arg0)
  Comparing master and cf

  ### catchingAll

  void catchingAll (Consumer<CodeBuilder.BlockCodeBuilder> catchAllHandler)
  Adds a "catch" block that catches all exceptions.

  The `CodeBuilder.BlockCodeBuilder.breakLabel()` for the catch block corresponds to the break label of the `tryHandler` block in `CodeBuilder.trying(Consumer, Consumer)` .

  The caught exception will be on top of the operand stack when the catch block is entered.

  Parameters:
    `catchAllHandler` - handler that receives a `Moved out of a link with destination CodeBuilder.html with title interface in java.lang.classfile.Moved to a link with destination CodeBuilder.BlockCodeBuilder.html with title interface in java.lang.classfile.Moved to a computer code block.CodeBuilder.BlockCodeBuilder` to generate the body of the catch block
  Throws:
    `IllegalArgumentException` - if an existing catch block catches all exceptions.
  See Also:
    - `catching(ClassDesc, Consumer)`
    - `catchingMulti(List, Consumer)`
- ≠
  public abstract java.lang.classfile.CodeBuilder.CatchBuilder catchingMulti(java.util.List<java.lang.constant.ClassDesc> arg0, java.util.function.Consumer<java.lang.classfile.CodeBuilder.BlockCodeBuilder> arg1)
  Comparing master and cf

  ### catchingMulti

  CodeBuilder.CatchBuilder catchingMulti (List<ClassDesc> exceptionTypes, Consumer<CodeBuilder.BlockCodeBuilder> catchHandler)
  Adds a catch block that catches exceptions of the given types.

  The caught exception will be on top of the operand stack when the catch block is entered.

  The `CodeBuilder.BlockCodeBuilder.breakLabel()` for the catch block corresponds to the break label of the `tryHandler` block in `CodeBuilder.trying(Consumer, Consumer)` .

  If list of exception types is empty If the type of exception is `null` then the catch block catches all exceptions.

  Parameters:
    `exceptionTypes` - the types of exception to catch.
    `catchHandler` - handler that receives a `Moved out of a link with destination CodeBuilder.html with title interface in java.lang.classfile.Moved to a link with destination CodeBuilder.BlockCodeBuilder.html with title interface in java.lang.classfile.Moved to a computer code block.CodeBuilder.BlockCodeBuilder` to generate the body of the catch block.
  Returns:
    this builder
  Throws:
    `IllegalArgumentException` - if an existing catch block catches one or more exceptions of the given types.
  See Also:
    - `catching(ClassDesc, Consumer)`
    - `catchingAll(Consumer)`

## Summary

Differences
| Elements | Comments | Descriptions | Total
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed
--- | --- | --- | --- | --- | --- | --- | --- | ---
CodeBuilder.CatchBuilder |  |  |  |  |  |  | 4 |  |  | 4
catching(ClassDesc,Consumer) |  |  |  |  |  |  | 5 | 1 | 1 | 7
catchingAll(Consumer) |  |  |  |  |  |  | 6 | 1 | 2 | 9
catchingMulti(List,Consumer) |  |  |  |  |  |  | 4 | 1 | 6 | 11
Total |  |  |  |  |  |  | 19 | 3 | 9 | 31