Skip to content

Commit cce3036

Browse files
committed
[GR-48926] Call the adapter when reflectively invoking a caller-sensitive method
PullRequest: graal/16580
2 parents 0f47e52 + 5d8f344 commit cce3036

File tree

1 file changed

+7
-0
lines changed
  • substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub

1 file changed

+7
-0
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/hub/DynamicHub.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
import jdk.internal.access.JavaLangReflectAccess;
127127
import jdk.internal.misc.Unsafe;
128128
import jdk.internal.reflect.CallerSensitive;
129+
import jdk.internal.reflect.CallerSensitiveAdapter;
129130
import jdk.internal.reflect.FieldAccessor;
130131
import jdk.internal.reflect.Reflection;
131132
import jdk.internal.reflect.ReflectionFactory;
@@ -1346,24 +1347,28 @@ private static Constructor<?>[] copyConstructors(Constructor<?>[] original) {
13461347

13471348
@Substitute
13481349
@Platforms(InternalPlatform.NATIVE_ONLY.class)
1350+
@CallerSensitive
13491351
private static Class<?> forName(String className) throws Throwable {
13501352
return forName(className, Reflection.getCallerClass());
13511353
}
13521354

13531355
@Substitute
13541356
@Platforms(InternalPlatform.NATIVE_ONLY.class)
1357+
@CallerSensitiveAdapter
13551358
private static Class<?> forName(String className, Class<?> caller) throws Throwable {
13561359
return forName(className, true, caller.getClassLoader(), caller);
13571360
}
13581361

13591362
@Substitute
13601363
@Platforms(InternalPlatform.NATIVE_ONLY.class)
1364+
@CallerSensitive
13611365
private static Class<?> forName(Module module, String className) throws Throwable {
13621366
return forName(module, className, Reflection.getCallerClass());
13631367
}
13641368

13651369
@Substitute
13661370
@Platforms(InternalPlatform.NATIVE_ONLY.class)
1371+
@CallerSensitiveAdapter
13671372
private static Class<?> forName(@SuppressWarnings("unused") Module module, String className, Class<?> caller) throws Throwable {
13681373
/*
13691374
* The module system is not supported for now, therefore the module parameter is ignored and
@@ -1377,11 +1382,13 @@ private static Class<?> forName(@SuppressWarnings("unused") Module module, Strin
13771382
}
13781383

13791384
@Substitute
1385+
@CallerSensitive
13801386
private static Class<?> forName(String name, boolean initialize, ClassLoader loader) throws Throwable {
13811387
return forName(name, initialize, loader, Reflection.getCallerClass());
13821388
}
13831389

13841390
@Substitute
1391+
@CallerSensitiveAdapter
13851392
private static Class<?> forName(String name, boolean initialize, ClassLoader loader, @SuppressWarnings("unused") Class<?> caller) throws Throwable {
13861393
if (name == null) {
13871394
throw new NullPointerException();

0 commit comments

Comments
 (0)