rpuch commented on a change in pull request #593:
URL: https://github.com/apache/ignite-3/pull/593#discussion_r792515108
##########
File path:
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/marshal/DefaultUserObjectMarshaller.java
##########
@@ -274,30 +195,56 @@ private boolean mayHaveObjectIdentity(ClassDescriptor
descriptor) {
return !descriptor.clazz().isPrimitive() && !descriptor.isNull();
}
- private void writeReference(int objectId, DataOutput output) throws
IOException {
-
ProtocolMarshalling.writeDescriptorOrCommandId(BuiltInType.REFERENCE.descriptorId(),
output);
+ private void writeReference(int objectId, Class<?> declaredClass,
DataOutput output) throws IOException {
+ if (!concreteTypeIsKnownUpfront(declaredClass)) {
+
ProtocolMarshalling.writeDescriptorOrCommandId(BuiltInType.REFERENCE.descriptorId(),
output);
+ }
ProtocolMarshalling.writeObjectId(objectId, output);
}
- private void marshalIdentifiable(DescribedObject describedObject, int
objectId, DataOutputStream output, MarshallingContext context)
- throws IOException, MarshalException {
- writeDescriptorId(describedObject.descriptor, output);
+ private void marshalIdentifiable(
+ Object object,
+ ClassDescriptor descriptor,
+ @Nullable Class<?> declaredClass,
+ int objectId,
+ DataOutputStream output,
+ MarshallingContext context
+ ) throws IOException, MarshalException {
+ if (!concreteTypeIsKnownUpfront(declaredClass)) {
+ writeDescriptorId(descriptor, output);
+ }
ProtocolMarshalling.writeObjectId(objectId, output);
- writeObject(describedObject.object, describedObject.descriptor,
output, context);
+ writeObject(object, descriptor, output, context);
}
- private void marshalValue(DescribedObject describedObject,
DataOutputStream output, MarshallingContext context)
- throws IOException, MarshalException {
- writeDescriptorId(describedObject.descriptor, output);
+ private boolean concreteTypeIsKnownUpfront(@Nullable Class<?>
declaredClass) {
Review comment:
Changed the terminology to mention runtime type instead (it seems really
suitable in this case).
--
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]