Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,12 @@ public enum ReportingMode {
@Option(help = "file:doc-files/PreserveHelp.txt")//
public static final HostedOptionKey<AccumulatingLocatableMultiOptionValue.Strings> Preserve = new HostedOptionKey<>(AccumulatingLocatableMultiOptionValue.Strings.build());

@Option(help = "file:doc-files/PreserveHelp.txt")//
public static final HostedOptionKey<AccumulatingLocatableMultiOptionValue.Strings> IgnorePreserveForClasses = new HostedOptionKey<>(AccumulatingLocatableMultiOptionValue.Strings.build());

@Option(help = "file:doc-files/PreserveHelp.txt")//
public static final HostedOptionKey<AccumulatingLocatableMultiOptionValue.Strings> IgnorePreserveForClassesPaths = new HostedOptionKey<>(AccumulatingLocatableMultiOptionValue.Strings.build());

@Option(help = "Force include include all public types and methods that can be reached using normal Java access rules.")//
public static final HostedOptionKey<Boolean> UseBaseLayerInclusionPolicy = new HostedOptionKey<>(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1096,8 +1096,11 @@ protected void setupNativeImage(String imageName, OptionValues options, Map<Meth
loader.classLoaderSupport.getClassesToIncludeUnconditionally().forEach(cls -> bb.registerTypeForBaseImage(cls));

var runtimeReflection = ImageSingletons.lookup(RuntimeReflectionSupport.class);

var classesToIgnore = OptionClassFilterBuilder.createFilter(loader, SubstrateOptions.IgnorePreserveForClasses, SubstrateOptions.IgnorePreserveForClassesPaths);
loader.classLoaderSupport.getClassesToPreserve().parallel()
.filter(ClassInclusionPolicy::isClassIncludedBase)
.filter(c -> classesToIgnore.isIncluded(c) == null)
.forEach(c -> runtimeReflection.registerClassFully(ConfigurationCondition.alwaysTrue(), c));
for (String className : loader.classLoaderSupport.getClassNamesToPreserve()) {
RuntimeReflection.registerClassLookup(className);
Expand Down
Loading