Interface Feature.BeforeAnalysisAccess
- All Superinterfaces:
Feature.FeatureAccess
- All Known Subinterfaces:
Feature.DuringAnalysisAccess
- Enclosing interface:
Feature
Access methods available for
Feature.beforeAnalysis(Feature.BeforeAnalysisAccess).- Since:
- 19.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidregisterAsAccessed(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.voidregisterAsInHeap(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.voidregisterAsUnsafeAccessed(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.voidregisterAsUnsafeAllocated(Class<?> type) Registers the provided type as allocatable without running a constructor, via Unsafe.allocateInstance or via the JNI function AllocObject.voidregisterAsUsed(Class<?> type) Registers the provided type a used, i.e., metadata for the type is put into the native image.voidregisterClassInitializerReachabilityHandler(Consumer<Feature.DuringAnalysisAccess> callback, Class<?> clazz) Registers a callback that is invoked onceduring analysiswhen the class initializer for the given type is determined to be reachable at run time.voidregisterFieldValueTransformer(Field field, FieldValueTransformer transformer) Registers a field value transformer for the provided field.voidregisterMethodOverrideReachabilityHandler(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.voidregisterReachabilityHandler(Consumer<Feature.DuringAnalysisAccess> callback, Object... elements) Registers a callback that is invoked onceduring analysiswhen any of the provided elements is determined to be reachable at run time.voidregisterSubtypeReachabilityHandler(BiConsumer<Feature.DuringAnalysisAccess, Class<?>> callback, Class<?> baseClass) Registers a callback that is invoked onceduring analysisfor each time a subtype of the class specified by {param baseClass} is determined to be reachable at run time.Methods inherited from interface 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
-
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
-
registerReachabilityHandler
void registerReachabilityHandler(Consumer<Feature.DuringAnalysisAccess> callback, Object... elements) Registers a callback that is invoked onceduring analysiswhen any of the provided elements is determined to be reachable at run time. The elements can only be of the following types:Classto specify reachability of the given classFieldto specify reachability of a fieldExecutableto 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 analysisfor 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 analysiswhen 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 ofFieldValueTransformerfor details.- Since:
- 22.3
-