Skip to content

[GR-54871] [JDK-8229959] Execute bootstrap methods for Proxy at image build time. #9184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,21 @@
import java.lang.invoke.TypeDescriptor;
import java.lang.reflect.Executable;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.lang.runtime.ObjectMethods;
import java.lang.runtime.SwitchBootstraps;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.hosted.RuntimeReflection;

import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
import com.oracle.svm.core.feature.InternalFeature;
import com.oracle.svm.util.ReflectionUtil;

import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
import jdk.vm.ci.meta.ResolvedJavaMethod;

/**
Expand Down Expand Up @@ -161,7 +162,14 @@ public boolean isIndyAllowedAtBuildTime(Executable method) {
* Check if the provided method is allowed to be executed at build time.
*/
public boolean isCondyAllowedAtBuildTime(Executable method) {
return method != null && condyBuildTimeAllowList.contains(method);
return method != null && (condyBuildTimeAllowList.contains(method) || isProxyCondy(method));
}

/**
* Every {@link Proxy} class has its own bootstrap method that is used for a constant dynamic.
*/
private static boolean isProxyCondy(Executable method) {
return Proxy.isProxyClass(method.getDeclaringClass()) && method.getName().equals("$getMethod");
}

/**
Expand Down