MrChang0 commented on code in PR #1616:
URL: https://github.com/apache/incubator-fury/pull/1616#discussion_r1596305293
##########
java/fury-core/src/main/java/org/apache/fury/serializer/collection/CollectionSerializers.java:
##########
@@ -411,6 +415,66 @@ public ConcurrentSkipListSet newCollection(MemoryBuffer
buffer) {
}
}
+ public static final class SetFromMapSerializer extends
CollectionSerializer<Set<?>> {
+
+ private static final long MAP_FIELD_OFFSET;
+
+ static {
+ try {
+ Field mapField =
Class.forName("java.util.Collections$SetFromMap").getDeclaredField("m");
+ MAP_FIELD_OFFSET = Platform.objectFieldOffset(mapField);
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public SetFromMapSerializer(Fury fury, Class<Set<?>> type) {
+ super(fury, type, false);
+ }
+
+ @Override
+ public Collection newCollection(MemoryBuffer buffer) {
+ int numElements = buffer.readVarUint32Small7();
+ setNumElements(numElements);
+ final ClassInfo mapClassInfo =
fury.getClassResolver().readClassInfo(buffer);
+ final MethodHandle methodHandle =
ReflectionUtils.getCtrHandle(mapClassInfo.getCls(), true);
Review Comment:
ok, I change it. I test this version in graalvm and it works, I wandering
why.
--
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]