Package org.graalvm.nativeimage.hosted
Interface Feature.BeforeAnalysisAccess
- All Superinterfaces:
Feature.FeatureAccess
- All Known Subinterfaces:
Feature.DuringAnalysisAccess
- Enclosing interface:
Feature
Access methods available for
Feature.beforeAnalysis(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess)
.- Since:
- 19.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.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.void
registerAsUnsafeAccessed
(Field field) Registers the provided field as written or read byUnsafe
, i.e., the static analysis merges together all values of unsafe accessed fields of a specific type.void
registerAsUnsafeAllocated
(Class<?> type) Registers the provided type as allocatable without running a constructor, via Unsafe.allocateInstance or via the JNI function AllocObject.void
registerAsUsed
(Class<?> type) Registers the provided type a used, i.e., metadata for the type is put into the native image.void
registerClassInitializerReachabilityHandler
(Consumer<Feature.DuringAnalysisAccess> callback, Class<?> clazz) Registers a callback that is invoked onceduring analysis
when the class initializer for the given type is determined to be reachable at run time.void
registerFieldValueTransformer
(Field field, FieldValueTransformer transformer) Registers a field value transformer for the provided field.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.void
registerReachabilityHandler
(Consumer<Feature.DuringAnalysisAccess> callback, Object... elements) Registers a callback that is invoked onceduring analysis
when any of the provided elements is determined to be reachable at run time.void
registerSubtypeReachabilityHandler
(BiConsumer<Feature.DuringAnalysisAccess, Class<?>> callback, Class<?> baseClass) Registers a callback that is invoked onceduring analysis
for each time a subtype of the class specified by {param baseClass} is determined to be reachable at run time.Methods inherited from interface org.graalvm.nativeimage.hosted.Feature.FeatureAccess
findClassByName, getApplicationClassLoader, getApplicationClassPath, getApplicationModulePath
-
Method Details
-
registerAsUsed
Registers the provided type a used, i.e., metadata for the type is put into the native image.- Since:
- 19.0
-
registerAsInHeap
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
Registers the provided type as allocatable without running a constructor, via Unsafe.allocateInstance or via the JNI function AllocObject.- Since:
- 24.1
-
registerAsAccessed
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
Registers the provided field as written or read byUnsafe
, 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 onceduring 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 classField
to specify reachability of a fieldExecutable
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 onceduring 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 onceduring analysis
when the class initializer for the given type is determined to be reachable at run time.- Since:
- 21.0
-
registerFieldValueTransformer
Registers a field value transformer for the provided field. See the JavaDoc ofFieldValueTransformer
for details.- Since:
- 22.3
-