Interface CodeRelabeler
- All Superinterfaces:
ClassFileTransform<CodeTransform, CodeElement, CodeBuilder>
,CodeTransform
A code relabeler is a
CodeTransform
replacing all occurrences
of Label
in the transformed code with new instances.
All 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
Label
is bound in the target bytecode exactly once.
- Since:
- 24
-
Field Summary
Fields declared in interface java.lang.classfile.CodeTransform
ACCEPT_ALL
-
Method Summary
Modifier and TypeMethodDescriptionstatic CodeRelabeler
of()
Creates a new instance of CodeRelabeler.static CodeRelabeler
of
(BiFunction<Label, CodeBuilder, Label> mapFunction) Creates a new instance of CodeRelabeler using providedBiFunction
to re-label the code.static CodeRelabeler
Creates a new instance of CodeRelabeler storing the label mapping into the provided map.Methods declared in interface java.lang.classfile.ClassFileTransform
accept, atEnd, atStart
Methods declared in interface java.lang.classfile.CodeTransform
andThen
-
Method Details
-
of
Creates a new instance of CodeRelabeler.- Returns:
- a new instance of CodeRelabeler
-
of
Creates a new instance of CodeRelabeler storing the label mapping into the provided map.- Parameters:
map
- label map actively used for relabeling- Returns:
- a new instance of CodeRelabeler
-
of
Creates a new instance of CodeRelabeler using providedBiFunction
to re-label the code.- Parameters:
mapFunction
- function for remapping labels in the source code model- Returns:
- a new instance of CodeRelabeler
-