Skip to content

Commit 5f7a282

Browse files
committed
[GR-74317] Fix runtime class loading after ClassRegistries changes
PullRequest: graal/23652
2 parents 12a6e47 + 84a8fb5 commit 5f7a282

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/ReflectionDataBuilder.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
import com.oracle.svm.configure.config.ConfigurationMemberInfo.ConfigurationMemberAccessibility;
9090
import com.oracle.svm.core.configure.ConditionalRuntimeValue;
9191
import com.oracle.svm.core.configure.RuntimeDynamicAccessMetadata;
92-
import com.oracle.svm.shared.singletons.AutomaticallyRegisteredImageSingleton;
9392
import com.oracle.svm.core.hub.DynamicHub;
9493
import com.oracle.svm.core.hub.PredefinedClassesSupport;
9594
import com.oracle.svm.core.hub.RuntimeClassLoading;
@@ -106,6 +105,7 @@
106105
import com.oracle.svm.hosted.SVMHost;
107106
import com.oracle.svm.hosted.annotation.SubstrateAnnotationExtractor;
108107
import com.oracle.svm.hosted.substitute.SubstitutionReflectivityFilter;
108+
import com.oracle.svm.shared.singletons.AutomaticallyRegisteredImageSingleton;
109109
import com.oracle.svm.shared.singletons.ImageSingletonLoader;
110110
import com.oracle.svm.shared.singletons.ImageSingletonWriter;
111111
import com.oracle.svm.shared.singletons.LayeredPersistFlags;
@@ -401,7 +401,11 @@ public void registerClassLookup(AccessCondition condition, boolean preserved, St
401401
}
402402

403403
private void registerClassLookupException(AccessCondition condition, String typeName, Throwable t, boolean preserved) {
404-
if (RuntimeClassLoading.isSupported()) {
404+
if (RuntimeClassLoading.isSupported() && t != null) {
405+
/*
406+
* Linkage errors don't need to be stored in the image when runtime class loading is
407+
* enabled as they can be recreated when trying to load the class at run-time.
408+
*/
405409
return;
406410
}
407411
if (layeredReflectionDataBuilder != null && layeredReflectionDataBuilder.isTypeNameRegistered(typeName)) {

0 commit comments

Comments
 (0)