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 ;
@@ -1098,10 +1099,10 @@ protected void setupNativeImage(String imageName, OptionValues options, Map<Meth
1098
1099
1099
1100
var runtimeReflection = ImageSingletons .lookup (RuntimeReflectionSupport .class );
1100
1101
1101
- var classesToIgnore = OptionClassFilterBuilder . createFilter ( loader , SubstrateOptions . IgnorePreserveForClasses , SubstrateOptions . IgnorePreserveForClassesPaths );
1102
+ Set < String > classesOrPackagesToIgnore = ignoredClassesOrPackagesForPreserve ( );
1102
1103
loader .classLoaderSupport .getClassesToPreserve ().parallel ()
1103
1104
.filter (ClassInclusionPolicy ::isClassIncludedBase )
1104
- .filter (c -> classesToIgnore . isIncluded ( c ) == null )
1105
+ .filter (c -> classesOrPackagesToIgnore . contains ( c . getPackageName ()) || classesOrPackagesToIgnore . contains ( c . getName ()) )
1105
1106
.forEach (c -> runtimeReflection .registerClassFully (ConfigurationCondition .alwaysTrue (), c ));
1106
1107
for (String className : loader .classLoaderSupport .getClassNamesToPreserve ()) {
1107
1108
RuntimeReflection .registerClassLookup (className );
@@ -1114,6 +1115,13 @@ protected void setupNativeImage(String imageName, OptionValues options, Map<Meth
1114
1115
}
1115
1116
}
1116
1117
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
+
1117
1125
protected void registerEntryPointStubs (Map <Method , CEntryPointData > entryPoints ) {
1118
1126
entryPoints .forEach ((method , entryPointData ) -> CEntryPointCallStubSupport .singleton ().registerStubForMethod (method , () -> entryPointData ));
1119
1127
}
0 commit comments