Class NativeImageUtils


  • @InternalApi
    public class NativeImageUtils
    extends Object
    Internal class offering helper methods for registering methods/classes for reflection.
    • Method Detail

      • getMethodOrFail

        public static Method getMethodOrFail​(Class<?> clazz,
                                             String methodName,
                                             Class<?>... params)
        Returns the method of a class or fails if it is not present.
      • registerForReflectiveInstantiation

        public static void registerForReflectiveInstantiation​(org.graalvm.nativeimage.hosted.Feature.FeatureAccess access,
                                                              String className)
        Registers a class for reflective construction via its default constructor.
      • registerConstructorsForReflection

        public static void registerConstructorsForReflection​(org.graalvm.nativeimage.hosted.Feature.FeatureAccess access,
                                                             String name)
        Registers all constructors of a class for reflection.
      • registerClassForReflection

        public static void registerClassForReflection​(org.graalvm.nativeimage.hosted.Feature.FeatureAccess access,
                                                      String name)
        Registers an entire class for reflection use.
      • registerClassHierarchyForReflection

        public static void registerClassHierarchyForReflection​(org.graalvm.nativeimage.hosted.Feature.FeatureAccess access,
                                                               String className)
        Registers the transitive class hierarchy of the provided className for reflection.

        The transitive class hierarchy contains the class itself and its transitive set of *non-private* nested subclasses.

      • registerForUnsafeFieldAccess

        public static void registerForUnsafeFieldAccess​(org.graalvm.nativeimage.hosted.Feature.FeatureAccess access,
                                                        String className,
                                                        String... fields)
        Registers a class for unsafe reflective field access.