Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt getCallerClass MH tests for ojdk11 MHs #18372

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public static boolean fromBootClassLoader() {

subTestResult &= GetCallerClassTests.test_getCallerClass_fromBootExtWithAnnotation();
subTestResult &= GetCallerClassTests.test_ensureCalledFromBootstrapClass_fromBootWithAnnotation();
subTestResult &= RefectionMHTests.test_getCallerClass_Helper_Reflection_fromBootExtWithAnnotation();
subTestResult &= RefectionMHTests.test_getCallerClass_Direct_Reflection_fromBootExtClassLoader();
subTestResult &= RefectionMHTests.test_getCallerClass_Helper_MethodHandle_fromBootExtWithAnnotation();
subTestResult &= RefectionMHTests.test_getCallerClass_Direct_MethodHandle_fromBootExtClassLoader();
subTestResult &= RefectionMHTests.test_getCallerClass_MethodHandle_ArgumentHelper();
subTestResult &= ReflectionMHTests.test_getCallerClass_Helper_Reflection_fromBootExtWithAnnotation();
subTestResult &= ReflectionMHTests.test_getCallerClass_Direct_Reflection_fromBootExtClassLoader();
subTestResult &= ReflectionMHTests.test_getCallerClass_Helper_MethodHandle_fromBootExtWithAnnotation();
subTestResult &= ReflectionMHTests.test_getCallerClass_Direct_MethodHandle_fromBootExtClassLoader();
subTestResult &= ReflectionMHTests.test_getCallerClass_MethodHandle_ArgumentHelper();

subTestResult &= GetCallerClassTests.test_getCallerClass_fromBootExtWithoutAnnotation();
subTestResult &= GetCallerClassTests.test_ensureCalledFromBootstrapClass_fromBootExtWithoutAnnotation();
Expand All @@ -91,11 +91,11 @@ public static boolean fromExtClassLoader() {

subTestResult &= GetCallerClassTests.test_getCallerClass_fromBootExtWithAnnotation();
subTestResult &= GetCallerClassTests.test_ensureCalledFromBootstrapClass_fromExtWithAnnotation();
subTestResult &= RefectionMHTests.test_getCallerClass_Helper_Reflection_fromBootExtWithAnnotation();
subTestResult &= RefectionMHTests.test_getCallerClass_Direct_Reflection_fromBootExtClassLoader();
subTestResult &= RefectionMHTests.test_getCallerClass_Helper_MethodHandle_fromBootExtWithAnnotation();
subTestResult &= RefectionMHTests.test_getCallerClass_Direct_MethodHandle_fromBootExtClassLoader();
subTestResult &= RefectionMHTests.test_getCallerClass_MethodHandle_ArgumentHelper();
subTestResult &= ReflectionMHTests.test_getCallerClass_Helper_Reflection_fromBootExtWithAnnotation();
subTestResult &= ReflectionMHTests.test_getCallerClass_Direct_Reflection_fromBootExtClassLoader();
subTestResult &= ReflectionMHTests.test_getCallerClass_Helper_MethodHandle_fromBootExtWithAnnotation();
subTestResult &= ReflectionMHTests.test_getCallerClass_Direct_MethodHandle_fromBootExtClassLoader();
subTestResult &= ReflectionMHTests.test_getCallerClass_MethodHandle_ArgumentHelper();

subTestResult &= GetCallerClassTests.test_getCallerClass_fromBootExtWithoutAnnotation();
subTestResult &= GetCallerClassTests.test_ensureCalledFromBootstrapClass_fromBootExtWithoutAnnotation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Test cases intended for reflection and MethodHandle
*/
public class RefectionMHTests {
public class ReflectionMHTests {

/**
* Call getCallerClass() with a helper method via reflection from the bootstrap/extension
Expand All @@ -46,7 +46,7 @@ public static boolean test_getCallerClass_Helper_Reflection_fromBootExtWithAnnot
method = GetCallerClassTests.class.getDeclaredMethod("test_getCallerClass_MethodHandle");
cls = (Class<?>) method.invoke(null, new Object[0]);

if (cls == RefectionMHTests.class) {
if (cls == ReflectionMHTests.class) {
System.out.println(TESTCASE_NAME + ": PASSED: return " + cls.getName());
return true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,20 @@
/**
* Test cases intended for reflection and MethodHandle
*/
public class RefectionMHTests {
public class ReflectionMHTests {

private static boolean isSecurityFrameOrInjectedInvoker(Class<?> cls) {
return ("java.lang.invoke.SecurityFrame" == cls.getName()
|| cls.getName().startsWith(RefectionMHTests.class.getName() + "$$InjectedInvoker/"));
boolean rc = "java.lang.invoke.SecurityFrame" == cls.getName();
if (!rc) {
String injectedInvoker;
if (VersionCheck.major() < 15) {
injectedInvoker = ReflectionMHTests.class.getPackageName() + ".InjectedInvoker/";
} else {
injectedInvoker = ReflectionMHTests.class.getName() + "$$InjectedInvoker/";
}
rc = cls.getName().startsWith(injectedInvoker);
}
return rc;
}

/**
Expand All @@ -56,7 +65,7 @@ public static boolean test_getCallerClass_Helper_Reflection_fromBootExtWithAnnot
if (VersionCheck.major() >= 18) {
isClassNameExpected = isSecurityFrameOrInjectedInvoker(cls);
} else {
isClassNameExpected = (cls == RefectionMHTests.class);
isClassNameExpected = (cls == ReflectionMHTests.class);
}

if (isClassNameExpected) {
Expand Down