Interface InstrumentationService
public interface InstrumentationService
The SPI service entry point for instrumentation.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlookupImplementationMethod(Class<?> targetSuperclass, String methodName, Class<?> implementationClass, Class<?> checkerClass, String checkMethodName, Class<?>... parameterTypes) lookupMethods(Class<?> clazz) This method uses the method names of the provided class to identify the JDK method to instrument; it examines all methods prefixed bycheck$, and parses the rest of the name to extract the JDK method: Instance methods have the fully qualified class name (with .newInstrumenter(Class<?> clazz, Map<MethodKey, CheckMethod> methods)
-
Field Details
-
CHECK_METHOD_PREFIX
- See Also:
-
-
Method Details
-
newInstrumenter
-
lookupMethods
This method uses the method names of the provided class to identify the JDK method to instrument; it examines all methods prefixed bycheck$, and parses the rest of the name to extract the JDK method:-
Instance methods have the fully qualified class name (with . replaced by _), followed by $, followed by the method name. Example:
EntitlementChecker.check$java_lang_Runtime$halt(java.lang.Class<?>, java.lang.Runtime, int) -
Static methods have the fully qualified class name (with . replaced by _), followed by $$, followed by the method name. Example:
EntitlementChecker.check$java_lang_System$$exit(java.lang.Class<?>, int) -
Constructors have the fully qualified class name (with . replaced by _), followed by $ and nothing else. Example:
EntitlementChecker.check$java_lang_ClassLoader$(java.lang.Class<?>)
NOTE: look up of methods using this convention is the primary way we use to identify which methods to instrument, but other methods can be added to the map of methods to instrument. See
EntitlementInitialization.initialize(java.lang.instrument.Instrumentation)for details.- Parameters:
clazz- the class to inspect to find methods to instrument- Throws:
ClassNotFoundException- if the class is not defined or cannot be inspected
-
Instance methods have the fully qualified class name (with . replaced by _), followed by $, followed by the method name. Example:
-
lookupImplementationMethod
InstrumentationService.InstrumentationInfo lookupImplementationMethod(Class<?> targetSuperclass, String methodName, Class<?> implementationClass, Class<?> checkerClass, String checkMethodName, Class<?>... parameterTypes) throws NoSuchMethodException, ClassNotFoundException
-