creddy commented on issue #2249:
URL: https://github.com/apache/fury/issues/2249#issuecomment-2917722732
Our team looked into this further. What we believe is going on is that since
Scala object's are lazy, the singleton instance doesn't exist or it does exist,
but its value is `null` so when `SingletonObjectSerializer.read` is called we
get `null`.
A proposal for fixing this is:
```java
public SingletonObjectSerializer(Fury fury, Class type) {
super(fury, type);
+ if (Platform.UNSAFE.shouldBeInitialized(type)) {
+ Platform.UNSAFE.ensureClassInitialized(type);
+ }
try {
field = type.getDeclaredField("MODULE$");
} catch (NoSuchFieldException e) {
throw new RuntimeException(type + " doesn't have `MODULE$` field", e);
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]