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 ;
@@ -1098,10 +1099,10 @@ protected void setupNativeImage(String imageName, OptionValues options, Map<Meth
10981099
10991100 var runtimeReflection = ImageSingletons .lookup (RuntimeReflectionSupport .class );
11001101
1101- var classesToIgnore = OptionClassFilterBuilder . createFilter ( loader , SubstrateOptions . IgnorePreserveForClasses , SubstrateOptions . IgnorePreserveForClassesPaths );
1102+ Set < String > classesOrPackagesToIgnore = ignoredClassesOrPackagesForPreserve ( );
11021103 loader .classLoaderSupport .getClassesToPreserve ().parallel ()
11031104 .filter (ClassInclusionPolicy ::isClassIncludedBase )
1104- .filter (c -> classesToIgnore . isIncluded ( c ) == null )
1105+ .filter (c -> !( classesOrPackagesToIgnore . contains ( c . getPackageName ()) || classesOrPackagesToIgnore . contains ( c . getName ())) )
11051106 .forEach (c -> runtimeReflection .registerClassFully (ConfigurationCondition .alwaysTrue (), c ));
11061107 for (String className : loader .classLoaderSupport .getClassNamesToPreserve ()) {
11071108 RuntimeReflection .registerClassLookup (className );
@@ -1114,6 +1115,13 @@ protected void setupNativeImage(String imageName, OptionValues options, Map<Meth
11141115 }
11151116 }
11161117
1118+ private static Set <String > ignoredClassesOrPackagesForPreserve () {
1119+ Set <String > ignoredClassesOrPackages = new HashSet <>(SubstrateOptions .IgnorePreserveForClasses .getValue ().valuesAsSet ());
1120+ // GR-63360: Parsing of constant_ lambda forms fails
1121+ ignoredClassesOrPackages .add ("java.lang.invoke.LambdaForm$Holder" );
1122+ return Collections .unmodifiableSet (ignoredClassesOrPackages );
1123+ }
1124+
11171125 protected void registerEntryPointStubs (Map <Method , CEntryPointData > entryPoints ) {
11181126 entryPoints .forEach ((method , entryPointData ) -> CEntryPointCallStubSupport .singleton ().registerStubForMethod (method , () -> entryPointData ));
11191127 }
0 commit comments