Interface INativeHelper

  • All Known Implementing Classes:
    NativeHelper

    public interface INativeHelper
    Interface for classes implementing native helper functions. Used for utility. Various methods are used to get around restrictions, this is one of them. Therefore, do not use this directly, use VmHacks.get().
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean canSetAccessible()
      Tests if the setAccessible() method can be used.
      java.lang.Class<?> defineClass​(java.lang.String name, byte[] b, java.lang.ClassLoader loader)
      Define a class in any ClassLoader.
      void setAccessible​(java.lang.String flagname, java.lang.reflect.AccessibleObject accobj, boolean flag)
      Sets reflective object accessible without checks.
      boolean startInstrumentationAgent​(java.lang.String jarfile)
      Method for starting an instrumentation agent.
      boolean tryChangeUser​(java.lang.String username)
      Attempts to change the user of the process to the given name.
    • Method Detail

      • tryChangeUser

        boolean tryChangeUser​(java.lang.String username)
        Attempts to change the user of the process to the given name.
        Parameters:
        username - The target user name.
        Returns:
        True, if successful, false if the attempt probably failed.
      • setAccessible

        void setAccessible​(java.lang.String flagname,
                           java.lang.reflect.AccessibleObject accobj,
                           boolean flag)
        Sets reflective object accessible without checks.
        Parameters:
        accobj - The accessible object.
        flag - The flag value.
      • canSetAccessible

        boolean canSetAccessible()
        Tests if the setAccessible() method can be used.
        Returns:
        True, if method can be used.
      • defineClass

        java.lang.Class<?> defineClass​(java.lang.String name,
                                       byte[] b,
                                       java.lang.ClassLoader loader)
        Define a class in any ClassLoader.
      • startInstrumentationAgent

        boolean startInstrumentationAgent​(java.lang.String jarfile)
        Method for starting an instrumentation agent.
        Parameters:
        jarfile - The path to the jar file of the agent.
        Returns:
        True, on successful start.