43
43
import java .util .Collection ;
44
44
import java .util .Collections ;
45
45
import java .util .EnumSet ;
46
+ import java .util .HashSet ;
46
47
import java .util .List ;
47
48
import java .util .ListIterator ;
48
49
import java .util .Locale ;
@@ -1107,10 +1108,10 @@ protected void setupNativeImage(String imageName, OptionValues options, Map<Meth
1107
1108
1108
1109
var runtimeReflection = ImageSingletons .lookup (RuntimeReflectionSupport .class );
1109
1110
1110
- var classesToIgnore = OptionClassFilterBuilder . createFilter ( loader , SubstrateOptions . IgnorePreserveForClasses , SubstrateOptions . IgnorePreserveForClassesPaths );
1111
+ Set < String > classesOrPackagesToIgnore = ignoredClassesOrPackagesForPreserve ( );
1111
1112
loader .classLoaderSupport .getClassesToPreserve ().parallel ()
1112
1113
.filter (ClassInclusionPolicy ::isClassIncludedBase )
1113
- .filter (c -> classesToIgnore . isIncluded ( c ) == null )
1114
+ .filter (c -> !( classesOrPackagesToIgnore . contains ( c . getPackageName ()) || classesOrPackagesToIgnore . contains ( c . getName ())) )
1114
1115
.forEach (c -> runtimeReflection .registerClassFully (ConfigurationCondition .alwaysTrue (), c ));
1115
1116
for (String className : loader .classLoaderSupport .getClassNamesToPreserve ()) {
1116
1117
RuntimeReflection .registerClassLookup (className );
@@ -1123,6 +1124,13 @@ protected void setupNativeImage(String imageName, OptionValues options, Map<Meth
1123
1124
}
1124
1125
}
1125
1126
1127
+ private static Set <String > ignoredClassesOrPackagesForPreserve () {
1128
+ Set <String > ignoredClassesOrPackages = new HashSet <>(SubstrateOptions .IgnorePreserveForClasses .getValue ().valuesAsSet ());
1129
+ // GR-63360: Parsing of constant_ lambda forms fails
1130
+ ignoredClassesOrPackages .add ("java.lang.invoke.LambdaForm$Holder" );
1131
+ return Collections .unmodifiableSet (ignoredClassesOrPackages );
1132
+ }
1133
+
1126
1134
protected void registerEntryPointStubs (Map <Method , CEntryPointData > entryPoints ) {
1127
1135
entryPoints .forEach ((method , entryPointData ) -> CEntryPointCallStubSupport .singleton ().registerStubForMethod (method , () -> entryPointData ));
1128
1136
}
0 commit comments