-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-26963][MLLIB] SizeEstimator can't make some JDK fields accessible in Java 9+ #23866
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
Conversation
| // do nothing | ||
| // Java 9+ can throw InaccessibleObjectException but the class is Java 9+-only | ||
| case re: RuntimeException | ||
| if re.getClass.getSimpleName == "InaccessibleObjectException" => |
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.
minor comment/question: if it's not an InaccessibleObjectException, wouldn't it throw a case match error which might be confusing? Just wondering if a default catch-all should re-raise the original "re: RuntimeException"
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.
The exception would just propagate, as before, if it's not matched by either case. That's what we want, if something else goes wrong.
| // Note: in Java 9+ this would be better with trySetAccessible and canAccess | ||
| try { | ||
| field.setAccessible(true) // Enable future get()'s on this field | ||
| pointerFields = field :: pointerFields |
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.
should this be inside the try:
pointerFields = field :: pointerFields
it seems like we could still record it even if the setAccessible failed?
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.
No, the point is that we don't want to try to access it below; it's not accessible
|
Test build #102606 has finished for PR 23866 at commit
|
|
Merged to master |
…ble in Java 9+ ## What changes were proposed in this pull request? Don't use inaccessible fields in SizeEstimator, which comes up in Java 9+ ## How was this patch tested? Manually ran tests with Java 11; it causes these tests that failed before to pass. This ought to pass on Java 8 as there's effectively no change for Java 8. Closes apache#23866 from srowen/SPARK-26963. Authored-by: Sean Owen <[email protected]> Signed-off-by: Sean Owen <[email protected]>
…ble in Java 9+ (#580) ## Upstream SPARK-26963 apache#23866 ## What changes were proposed in this pull request? Don't use inaccessible fields in SizeEstimator, which comes up in Java 9+ ## How was this patch tested? Manually ran tests with Java 11; it causes these tests that failed before to pass. This ought to pass on Java 8 as there's effectively no change for Java 8. Closes apache#23866 from srowen/SPARK-26963. Authored-by: Sean Owen <[email protected]> Signed-off-by: Sean Owen <[email protected]>
What changes were proposed in this pull request?
Don't use inaccessible fields in SizeEstimator, which comes up in Java 9+
How was this patch tested?
Manually ran tests with Java 11; it causes these tests that failed before to pass.
This ought to pass on Java 8 as there's effectively no change for Java 8.