Skip to content

Commit 04f76db

Browse files
authored
Merge pull request #18396 from ThanHenderson/14989-8
Adapt getCallerClass MH tests for ojdk8 MHs
2 parents 406c9da + e2b736f commit 04f76db

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/functional/cmdline_options_testresources/src_80/com/ibm/j9/getcallerclass/ReflectionMHTests.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
*/
3434
public class ReflectionMHTests {
3535

36+
private static boolean isSecurityFrameOrInjectedInvoker(Class<?> cls) {
37+
return ("java.lang.invoke.SecurityFrame" == cls.getName()
38+
|| cls.getName().startsWith("java.lang.invoke.MethodHandleImpl$BindCaller$T/"));
39+
}
40+
3641
/**
3742
* Call getCallerClass() with a helper method via reflection from the bootstrap/extension
3843
* classloader
@@ -108,7 +113,7 @@ public static boolean test_getCallerClass_Helper_MethodHandle_fromBootExtWithAnn
108113
methodHandle = lookup.findStatic(GetCallerClassTests.class, "test_getCallerClass_MethodHandle", methodType);
109114
cls = (Class<?>) methodHandle.invoke();
110115

111-
if ("java.lang.invoke.SecurityFrame" == cls.getName()) {
116+
if (isSecurityFrameOrInjectedInvoker(cls)) {
112117
System.out.println(TESTCASE_NAME + ": PASSED: return " + cls.getName());
113118
return true;
114119
} else {
@@ -174,7 +179,7 @@ public static boolean test_getCallerClass_MethodHandle_ArgumentHelper() {
174179
MethodHandle mhResult = MethodHandles.foldArguments(mhTarget, mhCombiner);
175180
cls = (Class<?>) mhResult.invoke();
176181

177-
if ("java.lang.invoke.SecurityFrame" == cls.getName()) {
182+
if (isSecurityFrameOrInjectedInvoker(cls)) {
178183
System.out.println(TESTCASE_NAME + ": PASSED: return " + cls.getName());
179184
return true;
180185
} else {

0 commit comments

Comments
 (0)