Top Description Inners Fields Constructors Methods
reactor.blockhound

pack-priv Class NativeWrappingClassFileTransformer

extends Object
implements ClassFileTransformer
Class Inheritance
All Implemented Interfaces
java.lang.instrument.ClassFileTransformer
Imports
net.bytebuddy.jar.asm.*, java.lang.instrument.ClassFileTransformer, java.security.ProtectionDomain, java.util.Map, .Set

This ASM-based transformer finds all methods defined in NativeWrappingClassFileTransformer#blockingMethods and creates a delegating method by prefixing the original native method.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static final Type
private final Map<String, Map<String, Set<String>>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public byte[]
transform(ClassLoader
the defining loader of the class to be transformed, may be null if the bootstrap loader
loader
,
String
the name of the class in the internal form of fully qualified class and interface names as defined in The Java Virtual Machine Specification. For example, "java/util/List".
className
,
Class<?>
if this is triggered by a redefine or retransform, the class being redefined or retransformed; if this is a class load, null
classBeingRedefined
,
ProtectionDomain
the protection domain of the class being defined or redefined
protectionDomain
,
byte[]
the input byte buffer in class file format - must not be modified
classfileBuffer
)

Overrides default java.lang.instrument.ClassFileTransformer.transform.

Transforms the given class file and returns a new replacement class file.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BLOCK_HOUND_RUNTIME_TYPEback to summary
pack-priv static final Type BLOCK_HOUND_RUNTIME_TYPE
blockingMethodsback to summary
private final Map<String, Map<String, Set<String>>> blockingMethods

Constructor Detail

NativeWrappingClassFileTransformerback to summary
pack-priv NativeWrappingClassFileTransformer(final Map<String, Map<String, Set<String>>> blockingMethods)

Method Detail

transformback to summary
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer)

Overrides default java.lang.instrument.ClassFileTransformer.transform.

Doc from java.lang.instrument.ClassFileTransformer.transform.

Transforms the given class file and returns a new replacement class file. This method is invoked when the Module bearing transform is not overridden.

Parameters
loader:ClassLoader

the defining loader of the class to be transformed, may be null if the bootstrap loader

className:String

the name of the class in the internal form of fully qualified class and interface names as defined in The Java Virtual Machine Specification. For example, "java/util/List".

classBeingRedefined:Class<?>

if this is triggered by a redefine or retransform, the class being redefined or retransformed; if this is a class load, null

protectionDomain:ProtectionDomain

the protection domain of the class being defined or redefined

classfileBuffer:byte[]

the input byte buffer in class file format - must not be modified

Returns:byte[]

a well-formed class file buffer (the result of the transform), or null if no transform is performed

Annotations
@Override
reactor.blockhound back to summary

pack-priv Class NativeWrappingClassFileTransformer.NativeWrappingClassVisitor

extends ClassVisitor
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final String
private final Map<String, Set<String>>
Inherited from net.bytebuddy.jar.asm.ClassVisitor:
apicv

Constructor Summary

AccessConstructor and Description
pack-priv
NativeWrappingClassVisitor(ClassVisitor cw, Map<String, Set<String>> methods, String internalClassName)

Method Summary

Modifier and TypeMethod and Description
public MethodVisitor
visitMethod(int
the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated.
access
,
String
the method's name.
name
,
String
the method's descriptor (see Type).
descriptor
,
String
the method's signature. May be null if the method parameters, return type and exceptions do not use generic types.
signature
,
String[]
the internal names of the method's exception classes (see Type#getInternalName()). May be null.
exceptions
)

Overrides net.bytebuddy.jar.asm.ClassVisitor.visitMethod.

Visits a method of the class.
Inherited from net.bytebuddy.jar.asm.ClassVisitor:
getDelegatevisitvisitAnnotationvisitAttributevisitEndvisitFieldvisitInnerClassvisitModulevisitNestHostvisitNestMembervisitOuterClassvisitPermittedSubclassvisitRecordComponentvisitSourcevisitTypeAnnotation

Field Detail

classNameback to summary
private final String className
methodsback to summary
private final Map<String, Set<String>> methods

Constructor Detail

NativeWrappingClassVisitorback to summary
pack-priv NativeWrappingClassVisitor(ClassVisitor cw, Map<String, Set<String>> methods, String internalClassName)

Method Detail

visitMethodback to summary
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions)

Overrides net.bytebuddy.jar.asm.ClassVisitor.visitMethod.

Doc from net.bytebuddy.jar.asm.ClassVisitor.visitMethod.

Visits a method of the class. This method must return a new MethodVisitor instance (or null) each time it is called, i.e., it should not return a previously returned visitor.

Parameters
access:int

the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated.

name:String

the method's name.

descriptor:String

the method's descriptor (see Type).

signature:String

the method's signature. May be null if the method parameters, return type and exceptions do not use generic types.

exceptions:String[]

the internal names of the method's exception classes (see Type#getInternalName()). May be null.

Returns:MethodVisitor

an object to visit the byte code of the method, or null if this class visitor is not interested in visiting the code of this method.

Annotations
@Override