imatiach-msft commented on a change in pull request #23866:
[SPARK-26963][MLLIB] SizeEstimator can't make some JDK fields accessible in
Java 9+
URL: https://github.com/apache/spark/pull/23866#discussion_r259214690
##########
File path: core/src/main/scala/org/apache/spark/util/SizeEstimator.scala
##########
@@ -334,9 +334,21 @@ object SizeEstimator extends Logging {
if (fieldClass.isPrimitive) {
sizeCount(primitiveSize(fieldClass)) += 1
} else {
- field.setAccessible(true) // Enable future get()'s on this field
+ // 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
Review comment:
should this be inside the try:
```
pointerFields = field :: pointerFields
```
it seems like we could still record it even if the setAccessible failed?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]