Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented Feb 22, 2019

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
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
Member Author

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
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
Member Author

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

SparkQA commented Feb 22, 2019

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
Member Author

srowen commented Feb 23, 2019

Merged to master

@srowen srowen closed this in ab4e83a Feb 23, 2019
@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.

Closes apache#23866 from srowen/SPARK-26963.

Authored-by: Sean Owen <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
bulldozer-bot bot 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.

Closes apache#23866 from srowen/SPARK-26963.

Authored-by: Sean Owen <[email protected]>
Signed-off-by: Sean Owen <[email protected]>
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.

3 participants