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

Update ClassLoader.findNative to support JEP 472 #20840

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

babsingh
Copy link
Contributor

A new version of ClassLoader.findNative has been introduced, which
accepts the Java method name and the Java class where the native
method is declared as input parameters. It performs native access
checks to comply with JEP 472 (Prepare to Restrict the Use of JNI).

Related: #19680
Related: #20354

A new version of ClassLoader.findNative has been introduced, which
accepts the Java method name and the Java class where the native
method is declared as input parameters. It performs native access
checks to comply with JEP 472 (Prepare to Restrict the Use of JNI).

Related: eclipse-openj9#19680
Related: eclipse-openj9#20354

Signed-off-by: Babneet Singh <[email protected]>
@babsingh
Copy link
Contributor Author

@tajila Requesting your review.

@babsingh babsingh requested a review from tajila December 16, 2024 17:09
static long findNative(ClassLoader loader, String entryName) {
/*[IF JAVA_SPEC_VERSION >= 24]*/
static long findNative1(ClassLoader loader, String entryName, Class<?> cls, String javaName) {
long address = findNative0(loader, entryName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the spec specify this order of checks? As in, if we look for a method that doesnt exist in a class that doesnt have native access, which error shows up?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec does not explicitly define the order of checks, but we can infer it from the available OpenJDK tests. Currently, we are aligned with the RI since we pass the majority of failing tests in #20354.

@tajila
Copy link
Contributor

tajila commented Dec 17, 2024

jenkins test sanity alinux64 jdk24

@tajila
Copy link
Contributor

tajila commented Dec 18, 2024

@babsingh are the failure known failures?

@babsingh
Copy link
Contributor Author

babsingh commented Dec 18, 2024

are the failure known failures?

Many are related to the missing Vthread pinning support, while other failures are unrelated to these changes.

All the failing tests in #20354 are passing now.

@tajila tajila merged commit 85b9c02 into eclipse-openj9:master Dec 18, 2024
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants