Skip to content

Commit 995b1f7

Browse files
committed
Remove @TargetClass annotation element only ever used for GuestGraal POC
1 parent 684c823 commit 995b1f7

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

sdk/src/com.oracle.svm.core.annotate/src/com/oracle/svm/core/annotate/TargetClass.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
import java.util.function.BooleanSupplier;
4848
import java.util.function.Function;
4949
import java.util.function.Predicate;
50-
import java.util.function.Supplier;
5150

5251
import org.graalvm.nativeimage.Platform;
5352
import org.graalvm.nativeimage.Platforms;
@@ -141,21 +140,6 @@
141140
*/
142141
String[] innerClass() default {};
143142

144-
/**
145-
* Specifies a custom classloader that will be used to look up the substitutee class name.
146-
*
147-
* @since 24.2
148-
*/
149-
Class<? extends Supplier<ClassLoader>> classLoader() default NoClassLoaderProvider.class;
150-
151-
/**
152-
* Marker value for {@link #classLoader} that no custom classloader should be used.
153-
*
154-
* @since 24.2
155-
*/
156-
interface NoClassLoaderProvider extends Supplier<ClassLoader> {
157-
}
158-
159143
/**
160144
* Substitute only if all provided predicates are true (default: unconditional substitution that
161145
* is always included).

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/substitute/AnnotationSubstitutionProcessor.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import java.util.function.BooleanSupplier;
4747
import java.util.function.Function;
4848
import java.util.function.Predicate;
49-
import java.util.function.Supplier;
5049

5150
import org.graalvm.nativeimage.AnnotationAccess;
5251
import org.graalvm.nativeimage.ImageSingletons;
@@ -1107,20 +1106,18 @@ Class<?> findTargetClass(Class<?> annotatedBaseClass, TargetClass target) {
11071106

11081107
protected Class<?> findTargetClass(Class<?> annotatedBaseClass, TargetClass target, boolean checkOnlyWith) {
11091108
return findTargetClass(TargetClass.class, TargetClass.NoClassNameProvider.class,
1110-
annotatedBaseClass, target, target.value(), target.className(), target.classNameProvider(), target.innerClass(), target.classLoader(),
1109+
annotatedBaseClass, target, target.value(), target.className(), target.classNameProvider(), target.innerClass(),
11111110
checkOnlyWith ? target.onlyWith() : null);
11121111
}
11131112

11141113
protected <T> Class<?> findTargetClass(Class<T> targetClass, Class<?> noClassNameProviderClass,
11151114
Class<?> annotatedBaseClass, T target, Class<?> value, String targetClassName, Class<? extends Function<T, String>> classNameProvider, String[] innerClasses,
1116-
Class<? extends Supplier<ClassLoader>> classloaderSupplier, Class<?>[] onlyWith) {
1115+
Class<?>[] onlyWith) {
11171116
Class<?> holder;
11181117
String className;
1119-
ClassLoader suppliedLoader = null;
11201118
if (value != targetClass) {
11211119
guarantee(targetClassName.isEmpty(), "Both class and class name specified for substitution");
11221120
guarantee(classNameProvider == noClassNameProviderClass, "Both class and classNameProvider specified for substitution");
1123-
guarantee(classloaderSupplier == TargetClass.NoClassLoaderProvider.class, "Annotation attribute 'classLoader' requires use of 'className' or 'classNameProvider'");
11241121

11251122
holder = value;
11261123
className = holder.getName();
@@ -1136,13 +1133,6 @@ protected <T> Class<?> findTargetClass(Class<T> targetClass, Class<?> noClassNam
11361133
guarantee(!targetClassName.isEmpty(), "Neither class, className, nor classNameProvider specified for substitution");
11371134
className = targetClassName;
11381135
}
1139-
if (classloaderSupplier != TargetClass.NoClassLoaderProvider.class) {
1140-
try {
1141-
suppliedLoader = ReflectionUtil.newInstance(classloaderSupplier).get();
1142-
} catch (ReflectionUtilError ex) {
1143-
throw UserError.abort(ex.getCause(), "Cannot instantiate classloaderSupplier: %s. The class must have a parameterless constructor.", classloaderSupplier.getTypeName());
1144-
}
1145-
}
11461136
}
11471137
if (onlyWith != null) {
11481138
for (Class<?> onlyWithClass : onlyWith) {
@@ -1172,7 +1162,7 @@ protected <T> Class<?> findTargetClass(Class<T> targetClass, Class<?> noClassNam
11721162
}
11731163

11741164
if (holder == null) {
1175-
var substitutionsClassLoaders = suppliedLoader != null ? List.of(suppliedLoader) : imageClassLoader.classLoaderSupport.getClassLoaders();
1165+
var substitutionsClassLoaders = imageClassLoader.classLoaderSupport.getClassLoaders();
11761166
for (ClassLoader substitutionsClassLoader : substitutionsClassLoaders) {
11771167
try {
11781168
holder = Class.forName(className, false, substitutionsClassLoader);

0 commit comments

Comments
 (0)