Skip to content

Commit

Permalink
Remove special class initialization handling for lambda classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Wimmer committed Jul 18, 2023
1 parent 4880346 commit f3114f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit f3114f9

Please sign in to comment.