diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/AllowAllHostedUsagesClassInitializationSupport.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/AllowAllHostedUsagesClassInitializationSupport.java index 2ccb82b10545..76058e96bccd 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/AllowAllHostedUsagesClassInitializationSupport.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/AllowAllHostedUsagesClassInitializationSupport.java @@ -26,8 +26,6 @@ import java.lang.reflect.Proxy; -import org.graalvm.compiler.java.LambdaUtils; - import com.oracle.graal.pointsto.meta.AnalysisMetaAccess; import com.oracle.graal.pointsto.meta.AnalysisUniverse; import com.oracle.svm.core.util.UserError; @@ -161,8 +159,8 @@ InitKind computeInitKindAndMaybeInitializeClass(Class clazz, boolean memoize) } superResult = superResult.max(processInterfaces(clazz, memoize)); - if (superResult == InitKind.BUILD_TIME && (Proxy.isProxyClass(clazz) || LambdaUtils.isLambdaType(metaAccess.lookupJavaType(clazz)))) { - forceInitializeHosted(clazz, "proxy/lambda classes with interfaces initialized at build time are also initialized at build time", false); + if (superResult == InitKind.BUILD_TIME && Proxy.isProxyClass(clazz)) { + forceInitializeHosted(clazz, "proxy classes with interfaces initialized at build time are also initialized at build time", false); return InitKind.BUILD_TIME; } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/ClassInitializationFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/ClassInitializationFeature.java index 06720f9809fe..534365051c08 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/ClassInitializationFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/classinitialization/ClassInitializationFeature.java @@ -39,6 +39,7 @@ import org.graalvm.collections.Pair; import org.graalvm.compiler.graph.Node; +import org.graalvm.compiler.java.LambdaUtils; import org.graalvm.compiler.options.OptionValues; import org.graalvm.compiler.phases.util.Providers; import org.graalvm.nativeimage.impl.clinit.ClassInitializationTracking; @@ -207,6 +208,7 @@ public void afterAnalysis(AfterAnalysisAccess a) { .filter(c -> c.getClassLoader() != null && c.getClassLoader() != ClassLoader.getPlatformClassLoader()) .filter(c -> classInitializationSupport.specifiedInitKindFor(c) == null) .map(Class::getTypeName) + .filter(name -> !LambdaUtils.isLambdaName(name)) .collect(Collectors.toList()); if (!unspecifiedClasses.isEmpty()) { System.err.println("The following classes have unspecified initialization policy:" + System.lineSeparator() + String.join(System.lineSeparator(), unspecifiedClasses));