Interface Feature.BeforeAnalysisAccess

All Superinterfaces:
Feature.FeatureAccess
All Known Subinterfaces:
Feature.DuringAnalysisAccess
Enclosing interface:
Feature

public static interface Feature.BeforeAnalysisAccess extends Feature.FeatureAccess
Since:
19.0
  • Method Details

    • registerAsUsed

      void registerAsUsed(Class<?> type)
      Registers the provided type a used, i.e., metadata for the type is put into the native image.
      Since:
      19.0
    • registerAsInHeap

      void registerAsInHeap(Class<?> type)
      Registers the provided type as instantiated, i.e., the static analysis assumes that instances of this type exist at run time even if there is no explicit instantiation in the bytecodes.

      This implies that the type is also marked as used.

      Since:
      19.0
    • registerAsUnsafeAllocated

      void registerAsUnsafeAllocated(Class<?> type)
      Registers the provided type as allocatable without running a constructor, via Unsafe.allocateInstance or via the JNI function AllocObject.
      Since:
      24.1
    • registerAsAccessed

      void registerAsAccessed(Field field)
      Registers the provided field as accesses, i.e., the static analysis assumes the field is used even if there are no explicit reads or writes in the bytecodes.
      Since:
      19.0
    • registerAsUnsafeAccessed

      void registerAsUnsafeAccessed(Field field)
      Registers the provided field as written or read by Unsafe, i.e., the static analysis merges together all values of unsafe accessed fields of a specific type.

      This implies that the field is also marked as accessed.

      Since:
      19.0
    • registerReachabilityHandler

      void registerReachabilityHandler(Consumer<Feature.DuringAnalysisAccess> callback, Object... elements)
      Registers a callback that is invoked once during analysis when any of the provided elements is determined to be reachable at run time. The elements can only be of the following types:

      • Class to specify reachability of the given class
      • Field to specify reachability of a field
      • Executable to specify reachability of a method or constructor

      Since:
      19.2
    • registerMethodOverrideReachabilityHandler

      void registerMethodOverrideReachabilityHandler(BiConsumer<Feature.DuringAnalysisAccess,Executable> callback, Executable baseMethod)
      Registers a callback that is invoked once during analysis for each time a method that overrides the specified {param baseMethod} is determined to be reachable at run time. In addition, the handler will also get invoked once when the {param baseMethod} itself becomes reachable. The specific method that becomes reachable is passed to the handler as the second parameter.

      A method is considered reachable at run time if it can be executed, as determined via static analysis.

      Therefore, if a method can be statically bound (usually, that means it is final or private or static, but not abstract, or the declaring class is final), or it is a constructors, and it is the target of a reachable invoke, or it is inlined, then it is considered run time reachable.

      A virtual methods is considered run time reachable if its declaring-class or any of its subtypes is instantiated and the method is the target of a reachable invoke, or it is inlined. Even if the declaring type itself is not marked as instantiated the method can still be reachable via special invokes, e.g., `super` calls.

      Since:
      19.3
    • registerSubtypeReachabilityHandler

      void registerSubtypeReachabilityHandler(BiConsumer<Feature.DuringAnalysisAccess,Class<?>> callback, Class<?> baseClass)
      Registers a callback that is invoked once during analysis for each time a subtype of the class specified by {param baseClass} is determined to be reachable at run time. In addition the handler will also get invoked once when the {param baseClass} itself becomes reachable. The specific class that becomes reachable is passed to the handler as the second parameter.
      Since:
      19.3
    • registerClassInitializerReachabilityHandler

      void registerClassInitializerReachabilityHandler(Consumer<Feature.DuringAnalysisAccess> callback, Class<?> clazz)
      Registers a callback that is invoked once during analysis when the class initializer for the given type is determined to be reachable at run time.
      Since:
      21.0
    • registerFieldValueTransformer

      void registerFieldValueTransformer(Field field, FieldValueTransformer transformer)
      Registers a field value transformer for the provided field. See the JavaDoc of FieldValueTransformer for details.
      Since:
      22.3