Class VmHacks


  • public class VmHacks
    extends java.lang.Object
    Class providing various means of getting around VM restrictions.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  VmHacks.InstrumentationCommand
      Instrumentation command issued to the instrumentation agent.
      static class  VmHacks.Unsafe
      Access to unsafe operations.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean DEBUG
      Set to true to see debug infos during startup.
      static boolean DISABLE
      Globally disable all VM Hacks.
      static boolean DISABLE_INSTRUMENTATION
      Disable all instrumentation-based functionality.
      static boolean DISABLE_NATIVE
      Globally disable native functionality.
      static boolean DISABLE_SETACCESSIBLE
      Globally disable setAccessible VM Hacks.
    • Constructor Summary

      Constructors 
      Constructor Description
      VmHacks()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static VmHacks.Unsafe get()
      Provides access to unsafe operations.
      protected static void injectClassIntoStore​(java.util.Map<java.lang.Object[],​java.lang.Class<?>> classstore, java.lang.ClassLoader cl, java.lang.String classname, java.lang.Class<?> clazz)
      Trampoline function for injection into the class redefinition store.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DISABLE

        public static boolean DISABLE
        Globally disable all VM Hacks.
      • DISABLE_SETACCESSIBLE

        public static boolean DISABLE_SETACCESSIBLE
        Globally disable setAccessible VM Hacks.
      • DISABLE_NATIVE

        public static boolean DISABLE_NATIVE
        Globally disable native functionality.
      • DISABLE_INSTRUMENTATION

        public static boolean DISABLE_INSTRUMENTATION
        Disable all instrumentation-based functionality.
      • DEBUG

        public static boolean DEBUG
        Set to true to see debug infos during startup.
    • Constructor Detail

      • VmHacks

        public VmHacks()
    • Method Detail

      • get

        public static final VmHacks.Unsafe get()
        Provides access to unsafe operations.
        Returns:
        The Unsafe object.
      • injectClassIntoStore

        protected static final void injectClassIntoStore​(java.util.Map<java.lang.Object[],​java.lang.Class<?>> classstore,
                                                         java.lang.ClassLoader cl,
                                                         java.lang.String classname,
                                                         java.lang.Class<?> clazz)
        Trampoline function for injection into the class redefinition store. This allows the stack trace to come from VmHacks instead of VmHacks$Unsafe, avoiding potential inner class naming inconsistencies.
        Parameters:
        classstore - The class store.
        cl - The targeted classloader.
        classname - Name of the class.
        clazz - The class.