Interface CodeRelabeler
- All Superinterfaces:
ClassFileTransformPREVIEW<CodeTransformPREVIEW,
,CodeElementPREVIEW, CodeBuilderPREVIEW> CodeTransformPREVIEW
CodeRelabeler
is a preview API of the Java platform.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A code relabeler is a
CodeTransform
PREVIEW replacing all occurrences
of Label
PREVIEW in the transformed code with new instances.
All LabelTarget
PREVIEW 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
PREVIEW is bound in the target bytecode exactly once.
- Since:
- 22
-
Nested Class Summary
Nested classes/interfaces declared in interface java.lang.classfile.ClassFileTransformPREVIEW
ClassFileTransform.ResolvedTransformPREVIEW<E extends ClassFileElementPREVIEW>
-
Field Summary
Fields declared in interface java.lang.classfile.CodeTransformPREVIEW
ACCEPT_ALL
-
Method Summary
Modifier and TypeMethodDescriptionstatic CodeRelabelerPREVIEW
of()
Creates a new instance of CodeRelabeler.static CodeRelabelerPREVIEW
of
(BiFunction<LabelPREVIEW, CodeBuilderPREVIEW, LabelPREVIEW> mapFunction) Creates a new instance of CodeRelabeler using providedBiFunction
to re-label the code.static CodeRelabelerPREVIEW
Creates a new instance of CodeRelabeler storing the label mapping into the provided map.relabel
(LabelPREVIEW label, CodeBuilderPREVIEW codeBuilder) Access method to internal re-labeling function.Methods declared in interface java.lang.classfile.ClassFileTransformPREVIEW
accept, atEnd, atStart
Methods declared in interface java.lang.classfile.CodeTransformPREVIEW
andThen, resolve
-
Method Details
-
of
Creates a new instance of CodeRelabeler.- Returns:
- a new instance of CodeRelabeler
-
of
-
of
static CodeRelabelerPREVIEW of(BiFunction<LabelPREVIEW, CodeBuilderPREVIEW, LabelPREVIEW> mapFunction) 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
-
relabel
-
CodeRelabeler
when preview features are enabled.