Skip to content

[SPARK-26963][MLLIB] SizeEstimator can't make some JDK fields accessible in Java 9+ - #23866

Closed
srowen wants to merge 1 commit into
apache:masterfrom
srowen:SPARK-26963
Closed

[SPARK-26963][MLLIB] SizeEstimator can't make some JDK fields accessible in Java 9+#23866
srowen wants to merge 1 commit into
apache:masterfrom
srowen:SPARK-26963

Conversation

@srowen

Copy link
Copy Markdown
Member

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.

// do nothing
// Java 9+ can throw InaccessibleObjectException but the class is Java 9+-only
case re: RuntimeException
if re.getClass.getSimpleName == "InaccessibleObjectException" =>

Copy link
Copy Markdown
Contributor

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"

Copy link
Copy Markdown
MemberAuthor

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

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
MemberAuthor

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

@SparkQA

Copy link
Copy Markdown

Test build #102606 has finished for PR 23866 at commit 271bf6f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@srowen

Copy link
Copy Markdown
MemberAuthor

Merged to master

@srowen
srowen deleted the SPARK-26963 branch February 27, 2019 14:35
robert3005 pushed a commit to palantir/spark that referenced this pull request Jun 14, 2019
…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.
Closesapache#23866 from srowen/SPARK-26963.
Authored-by: Sean Owen <sean.owen@databricks.com>
Signed-off-by: Sean Owen <sean.owen@databricks.com>
bulldozer-botBot pushed a commit to palantir/spark that referenced this pull request Jun 28, 2019
…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.
Closesapache#23866 from srowen/SPARK-26963.
Authored-by: Sean Owen <sean.owen@databricks.com>
Signed-off-by: Sean Owen <sean.owen@databricks.com>
Sign up for freeto 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.

3 participants

@srowen@SparkQA@imatiach-msft