APIdia Launch Partner
Top Description Fields Methods
jdk.internal.classfile.components

public sealed Interface CodeRelabeler

extends CodeTransform
permits CodeRelabelerImpl
Known Direct Implementers
jdk.internal.classfile.impl.CodeRelabelerImpl
Imports
java.lang.classfile.CodeBuilder, .CodeTransform, .Label, java.util.IdentityHashMap, .Map, java.util.function.BiFunction, jdk.internal.classfile.impl.CodeRelabelerImpl

A code relabeler is a CodeTransform replacing all occurrences of java.lang.classfile.Label in the transformed code with new instances. All java.lang.classfile.instruction.LabelTarget instructions are adjusted accordingly. Relabeled code graph is identical to the original.

Primary purpose of CodeRelabeler is for repeated injections of the same code blocks. Repeated injection of the same code block must be relabeled, so each instance of java.lang.classfile.Label is bound in the target bytecode exactly once.

Field Summary

Inherited from java.lang.classfile.CodeTransform:
ACCEPT_ALL

Method Summary

Modifier and TypeMethod and Description
public static CodeRelabeler

Returns:

a new instance of CodeRelabeler
of
()

Creates a new instance of CodeRelabeler.

public static CodeRelabeler

Returns:

a new instance of CodeRelabeler
of
(Map<Label, Label>
label map actively used for relabeling
map
)

Creates a new instance of CodeRelabeler storing the label mapping into the provided map.

public static CodeRelabeler

Returns:

a new instance of CodeRelabeler
of
(BiFunction<Label, CodeBuilder, Label>
function for remapping labels in the source code model
mapFunction
)

Creates a new instance of CodeRelabeler using provided java.util.function.BiFunction to re-label the code.

Inherited from java.lang.classfile.CodeTransform:
andThenendHandlerofStateful

Method Detail

ofback to summary
public static CodeRelabeler of()

Creates a new instance of CodeRelabeler.

Returns:CodeRelabeler

a new instance of CodeRelabeler

ofback to summary
public static CodeRelabeler of(Map<Label, Label> map)

Creates a new instance of CodeRelabeler storing the label mapping into the provided map.

Parameters
map:Map<Label, Label>

label map actively used for relabeling

Returns:CodeRelabeler

a new instance of CodeRelabeler

ofback to summary
public static CodeRelabeler of(BiFunction<Label, CodeBuilder, Label> mapFunction)

Creates a new instance of CodeRelabeler using provided java.util.function.BiFunction to re-label the code.

Parameters
mapFunction:BiFunction<Label, CodeBuilder, Label>

function for remapping labels in the source code model

Returns:CodeRelabeler

a new instance of CodeRelabeler