Skip to content

Commit ec780a9

Browse files
committed
Use hosted ServicesCatalog.CLV when querying PlatformClassLoader CLV
1 parent 5788751 commit ec780a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/RuntimeClassLoaderValueSupport.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ public static RuntimeClassLoaderValueSupport instance() {
8181
@Platforms(Platform.HOSTED_ONLY.class) //
8282
private final Field classLoaderCLVField = ReflectionUtil.lookupField(ClassLoader.class, "classLoaderValueMap");
8383

84+
@Platforms(Platform.HOSTED_ONLY.class) //
85+
private final ClassLoaderValue<ServicesCatalog> hostedServicesCatalogCLV = ReflectionUtil.readField(ServicesCatalog.class, "CLV", null);
86+
8487
@Platforms(Platform.HOSTED_ONLY.class) //
8588
public ConcurrentHashMap<?, ?> getClassLoaderValueMapForLoader(ClassLoader loader) {
8689
if (loader == null) {
@@ -159,7 +162,7 @@ public void registerServicesCatalog(ClassLoader loader) {
159162
public ServicesCatalog getHostedServiceCatalogForLoader(ClassLoader loader) {
160163
try {
161164
ConcurrentHashMap<?, ?> hostedLoaderCLV = (ConcurrentHashMap<?, ?>) classLoaderCLVField.get(loader);
162-
ServicesCatalog servicesCatalog = (ServicesCatalog) hostedLoaderCLV.get(servicesCatalogCLV);
165+
ServicesCatalog servicesCatalog = (ServicesCatalog) hostedLoaderCLV.get(hostedServicesCatalogCLV);
163166
return servicesCatalog;
164167
} catch (IllegalAccessException e) {
165168
throw VMError.shouldNotReachHere("Failed to query ClassLoader.classLoaderValueMap", e);

0 commit comments

Comments
 (0)