4343import java .util .Collection ;
4444import java .util .Collections ;
4545import java .util .EnumSet ;
46+ import java .util .HashSet ;
4647import java .util .List ;
4748import java .util .ListIterator ;
4849import java .util .Locale ;
@@ -1107,10 +1108,10 @@ protected void setupNativeImage(String imageName, OptionValues options, Map<Meth
11071108
11081109 var runtimeReflection = ImageSingletons .lookup (RuntimeReflectionSupport .class );
11091110
1110- var classesToIgnore = OptionClassFilterBuilder . createFilter ( loader , SubstrateOptions . IgnorePreserveForClasses , SubstrateOptions . IgnorePreserveForClassesPaths );
1111+ Set < String > classesOrPackagesToIgnore = ignoredClassesOrPackagesForPreserve ( );
11111112 loader .classLoaderSupport .getClassesToPreserve ().parallel ()
11121113 .filter (ClassInclusionPolicy ::isClassIncludedBase )
1113- .filter (c -> classesToIgnore . isIncluded ( c ) == null )
1114+ .filter (c -> !( classesOrPackagesToIgnore . contains ( c . getPackageName ()) || classesOrPackagesToIgnore . contains ( c . getName ())) )
11141115 .forEach (c -> runtimeReflection .registerClassFully (ConfigurationCondition .alwaysTrue (), c ));
11151116 for (String className : loader .classLoaderSupport .getClassNamesToPreserve ()) {
11161117 RuntimeReflection .registerClassLookup (className );
@@ -1123,6 +1124,13 @@ protected void setupNativeImage(String imageName, OptionValues options, Map<Meth
11231124 }
11241125 }
11251126
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+
11261134 protected void registerEntryPointStubs (Map <Method , CEntryPointData > entryPoints ) {
11271135 entryPoints .forEach ((method , entryPointData ) -> CEntryPointCallStubSupport .singleton ().registerStubForMethod (method , () -> entryPointData ));
11281136 }
0 commit comments