public class GraalCompileFixCryptoRegistrar extends Object implements org.graalvm.nativeimage.hosted.Feature
CryptoServicesRegistrar class, during CLI
generation. Because it is not allowed to have NativePRNG in image heap this breaks compilation.
We fix this by setting CryptoServicesRegistrar#defaultSecureRandom to NoOpRandom that
is simply stub class. Then, in runtime in main() CLI simply sets defaultSecureRandom to null
before doing any useful work and such trick forces CryptoServicesRegistrar to get correct SecureRandom
implementation, because when it is null BC initializes the field.org.graalvm.nativeimage.hosted.Feature.AfterAnalysisAccess, org.graalvm.nativeimage.hosted.Feature.AfterCompilationAccess, org.graalvm.nativeimage.hosted.Feature.AfterHeapLayoutAccess, org.graalvm.nativeimage.hosted.Feature.AfterImageWriteAccess, org.graalvm.nativeimage.hosted.Feature.AfterRegistrationAccess, org.graalvm.nativeimage.hosted.Feature.BeforeAnalysisAccess, org.graalvm.nativeimage.hosted.Feature.BeforeCompilationAccess, org.graalvm.nativeimage.hosted.Feature.BeforeImageWriteAccess, org.graalvm.nativeimage.hosted.Feature.CompilationAccess, org.graalvm.nativeimage.hosted.Feature.DuringAnalysisAccess, org.graalvm.nativeimage.hosted.Feature.DuringSetupAccess, org.graalvm.nativeimage.hosted.Feature.FeatureAccess, org.graalvm.nativeimage.hosted.Feature.IsInConfigurationAccess, org.graalvm.nativeimage.hosted.Feature.OnAnalysisExitAccess, org.graalvm.nativeimage.hosted.Feature.QueryReachabilityAccess| Constructor and Description |
|---|
GraalCompileFixCryptoRegistrar() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterRegistration(org.graalvm.nativeimage.hosted.Feature.AfterRegistrationAccess access) |
Copyright © 2020. All rights reserved.