public static interface Feature.BeforeAnalysisAccess extends Feature.FeatureAccess
Feature.beforeAnalysis(org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess)
.Modifier and Type | Method and Description |
---|---|
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.
|
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 by
Unsafe , i.e., the
static analysis merges together all values of unsafe accessed fields of a specific type. |
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 once
during 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 once
during 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 once
during analysis
for each time a subtype of the class specified by {param baseClass} is determined to be
reachable at run time. |
findClassByName, getApplicationClassLoader, getApplicationClassPath, getApplicationModulePath
void registerAsUsed(Class<?> type)
void registerAsInHeap(Class<?> type)
This implies that the type is also marked as used
.
void registerAsAccessed(Field field)
void registerAsUnsafeAccessed(Field field)
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
.
void registerReachabilityHandler(Consumer<Feature.DuringAnalysisAccess> callback, Object... elements)
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
void registerMethodOverrideReachabilityHandler(BiConsumer<Feature.DuringAnalysisAccess,Executable> callback, Executable baseMethod)
void registerSubtypeReachabilityHandler(BiConsumer<Feature.DuringAnalysisAccess,Class<?>> callback, Class<?> baseClass)
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.void registerClassInitializerReachabilityHandler(Consumer<Feature.DuringAnalysisAccess> callback, Class<?> clazz)
during analysis
when the class initializer for the given type is determined to be reachable at run time.void registerFieldValueTransformer(Field field, FieldValueTransformer transformer)
FieldValueTransformer
for details.