- All Superinterfaces:
ClassFileTransform<CodeTransform,,CodeElement, CodeBuilder> CodeTransform
- All Known Implementing Classes:
CodeRelabelerImpl
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:
- 22
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.glavo.classfile.ClassFileTransform
ClassFileTransform.ResolvedTransform<E extends ClassFileElement> -
Field Summary
Fields inherited from interface org.glavo.classfile.CodeTransform
ACCEPT_ALL -
Method Summary
Modifier and TypeMethodDescriptionstatic CodeRelabelerof()Creates a new instance of CodeRelabeler.static CodeRelabelerof(BiFunction<Label, CodeBuilder, Label> mapFunction) Creates a new instance of CodeRelabeler using providedBiFunctionto re-label the code.static CodeRelabelerCreates a new instance of CodeRelabeler storing the label mapping into the provided map.relabel(Label label, CodeBuilder codeBuilder) Access method to internal re-labeling function.Methods inherited from interface org.glavo.classfile.ClassFileTransform
accept, atEnd, atStartMethods inherited from interface org.glavo.classfile.CodeTransform
andThen, resolve
-
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 providedBiFunctionto re-label the code.- Parameters:
mapFunction- function for remapping labels in the source code model- Returns:
- a new instance of CodeRelabeler
-
relabel
Access method to internal re-labeling function.- Parameters:
label- source labelcodeBuilder- builder to create new labels- Returns:
- target label
-