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
CodeTransformPREVIEW replacing all occurrences
of LabelPREVIEW in the transformed code with new instances.
All LabelTargetPREVIEW 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
LabelPREVIEW is bound in the target bytecode exactly once.
- Since:
- 22
-
Field Summary
Fields declared in interface java.lang.classfile.CodeTransformPREVIEW
ACCEPT_ALL -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic CodeRelabelerPREVIEWof()Creates a new instance of CodeRelabeler.static CodeRelabelerPREVIEWof(BiFunction<LabelPREVIEW, CodeBuilderPREVIEW, LabelPREVIEW> mapFunction) Creates a new instance of CodeRelabeler using providedBiFunctionto re-label the code.static CodeRelabelerPREVIEWCreates a new instance of CodeRelabeler storing the label mapping into the provided map.Methods declared in interface java.lang.classfile.ClassFileTransformPREVIEW
accept, atEnd, atStartMethods declared in interface java.lang.classfile.CodeTransformPREVIEW
andThen
-
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 providedBiFunctionto re-label the code.- Parameters:
mapFunction- function for remapping labels in the source code model- Returns:
- a new instance of CodeRelabeler
-
CodeRelabelerwhen preview features are enabled.