-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
[Java] Fix out-dated signatures of JNI methods #2756
Conversation
Test FAILed. |
Test PASSed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to me.
Most of the function parameters in org_ray_spi_impl_DefaultLocalSchedulerClient.cc
don't have meaningful names. Could you also improve that with this PR? thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, though we should still get rid of the autogenerated files at some point.
I have updated some code. In conclusion, it contains 3 changes:
@robertnishihara @raulchen Could u plz review this again? |
@eric-jj cc |
Test PASSed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's lint error in org_ray_spi_impl_DefaultLocalSchedulerClient.cc
. Otherwise looks good.
Test PASSed. |
Test FAILed. |
I didn't change any py file, and just changed =============== 1 failed, 47 passed, 8 skipped in 218.85 seconds ===============
The command "python -m pytest -v test/actor_test.py" exited with 1. @robertnishihara Do u guys have any idea about it? |
@@ -153,7 +153,8 @@ Java_org_ray_spi_impl_DefaultLocalSchedulerClient_nativeReconstructObjects( | |||
std::vector<ObjectID> object_ids; | |||
auto len = env->GetArrayLength(objectIds); | |||
for (int i = 0; i < len; i++) { | |||
jbyteArray object_id_bytes = (jbyteArray) env->GetObjectArrayElement(objectIds, i); | |||
jbyteArray object_id_bytes = | |||
(jbyteArray) env->GetObjectArrayElement(objectIds, i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not use C style casts here
@@ -209,7 +211,8 @@ Java_org_ray_spi_impl_DefaultLocalSchedulerClient_nativeWaitObject( | |||
std::vector<ObjectID> object_ids; | |||
auto len = env->GetArrayLength(objectIds); | |||
for (int i = 0; i < len; i++) { | |||
jbyteArray object_id_bytes = (jbyteArray) env->GetObjectArrayElement(objectIds, i); | |||
jbyteArray object_id_bytes = | |||
(jbyteArray) env->GetObjectArrayElement(objectIds, i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C style cast
@jovan-wong I think those test failures are unrelated. Can you remove the C-style casts? Then I think we can merge it. |
@jovan-wong It's weird the first 2 jobs failed consistently for a few times. It should be unrelated. But let's at least make sure that the same test case doesn't fail again. Then I'll merge it. |
Test FAILed. |
Test PASSed. |
What do these changes do?
When Java code invoke native code by JNI, it will find the function by the function name which is declared in native code(
org_ray_spi_impl_DefaultLocalSchedulerClient.cc
). If there are some overloading functions, the JNI will find the most matching one by thesignature
in the comment, like this:Many signatures are not correct yet.
But because there are no overloading, this issue is not triggered.
In this PR, I do these things:
javah
tool.Related issue number
N/A