Class BytecodeTransformerBuildItem
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescription(package private) final boolean
(package private) final int
(package private) final String
(package private) final boolean
(package private) final boolean
If this is true it means the class should be loaded eagerly by a thread pool in dev mode on multithreaded systems.(package private) final BiFunction<String,
byte[], byte[]> Function that can be applied to the input bytes before it is passed into ASM.(package private) final int
A set of class names that need to be present in the const pool for the transformation to happen.(package private) final BiFunction<String,
org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> -
Constructor Summary
ConstructorDescriptionBytecodeTransformerBuildItem
(boolean eager, String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction) BytecodeTransformerBuildItem
(boolean eager, String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction, boolean cacheable) BytecodeTransformerBuildItem
(boolean eager, String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction, Set<String> requireConstPoolEntry) BytecodeTransformerBuildItem
(boolean eager, String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction, Set<String> requireConstPoolEntry, boolean cacheable) BytecodeTransformerBuildItem
(String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction) BytecodeTransformerBuildItem
(String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction, Set<String> requireConstPoolEntry) -
Method Summary
Modifier and TypeMethodDescriptionint
BiFunction<String,
byte[], byte[]> int
Bytecode transformers are applied in ascending priority order.BiFunction<String,
org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> boolean
boolean
boolean
isEager()
-
Field Details
-
eager
final boolean eagerIf this is true it means the class should be loaded eagerly by a thread pool in dev mode on multithreaded systems.Transformation is expensive, so doing it this way can speed up boot time.
-
classToTransform
-
visitorFunction
final BiFunction<String,org.objectweb.asm.ClassVisitor, visitorFunctionorg.objectweb.asm.ClassVisitor> -
inputTransformer
Function that can be applied to the input bytes before it is passed into ASM. This should only be used in very specific circumstances. At the moment the only known valid use case is JaCoCo, which needs access to the unmodified class file bytes. -
requireConstPoolEntry
A set of class names that need to be present in the const pool for the transformation to happen. These need to be in JVM internal format.The transformation is only applied if at least one of the entries in the const pool is present.
Note that this is an optimisation, and if another transformer is transforming the class anyway then this transformer will always be applied.
-
cacheable
final boolean cacheable -
classReaderOptions
final int classReaderOptions -
continueOnFailure
final boolean continueOnFailure -
priority
final int priority
-
-
Constructor Details
-
BytecodeTransformerBuildItem
public BytecodeTransformerBuildItem(String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction) -
BytecodeTransformerBuildItem
public BytecodeTransformerBuildItem(String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction, Set<String> requireConstPoolEntry) -
BytecodeTransformerBuildItem
public BytecodeTransformerBuildItem(boolean eager, String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction) -
BytecodeTransformerBuildItem
public BytecodeTransformerBuildItem(boolean eager, String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction, boolean cacheable) -
BytecodeTransformerBuildItem
public BytecodeTransformerBuildItem(boolean eager, String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction, Set<String> requireConstPoolEntry) -
BytecodeTransformerBuildItem
public BytecodeTransformerBuildItem(boolean eager, String classToTransform, BiFunction<String, org.objectweb.asm.ClassVisitor, org.objectweb.asm.ClassVisitor> visitorFunction, Set<String> requireConstPoolEntry, boolean cacheable) -
BytecodeTransformerBuildItem
-
-
Method Details
-
getClassToTransform
-
getVisitorFunction
public BiFunction<String,org.objectweb.asm.ClassVisitor, getVisitorFunction()org.objectweb.asm.ClassVisitor> -
getRequireConstPoolEntry
-
isEager
public boolean isEager() -
isCacheable
public boolean isCacheable() -
getClassReaderOptions
public int getClassReaderOptions() -
getInputTransformer
-
isContinueOnFailure
public boolean isContinueOnFailure() -
getPriority
public int getPriority()Bytecode transformers are applied in ascending priority order. That is, lower priority value means the transformer is applied sooner, and higher priority value means the transformer is applied later.This applies directly to
inputTransformer
functions: an input transformer function with lower priority is applied first and its result is passed to the transformer function with higher priority.It is a bit counter-intuitive when it comes to the
visitorFunction
. The visitor function doesn't directly transform bytecode; instead, it constructs an ASMClassVisitor
from an earlier class visitor. This means that the priority order is effectively turned around: the later a bytecode transformer is called, the higher in the class visitor chain it ends up, and the sooner is the visitor eventually called.The priority value defaults to
0
.
-