public interface Instrumenter
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    instrumentClass(String className, byte[] classfileBuffer, boolean verify)
    Instruments the appropriate methods of a class by adding a prologue that checks for entitlements.
  • Method Details

    • instrumentClass

      byte[] instrumentClass(String className, byte[] classfileBuffer, boolean verify)
      Instruments the appropriate methods of a class by adding a prologue that checks for entitlements. The prologue:
      1. gets the EntitlementChecker instance from the EntitlementCheckerHandle holder;
      2. identifies the caller class and pushes it onto the stack;
      3. forwards the instrumented function parameters;
      4. calls the EntitlementChecker method corresponding to the method it is injected into (e.g. check$java_net_DatagramSocket$receive for DatagramSocket.receive(java.net.DatagramPacket)).
      Parameters:
      className - the name of the class to instrument
      classfileBuffer - its bytecode
      verify - whether we should verify the bytecode before and after instrumentation
      Returns:
      the instrumented class bytes