You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/01/26 09:58:56 UTC

[GitHub] [ignite-3] SammyVimes commented on a change in pull request #593: IGNITE-15945 Class inheritance and effectively final fields

SammyVimes commented on a change in pull request #593:
URL: https://github.com/apache/ignite-3/pull/593#discussion_r792457336



##########
File path: modules/network/src/main/java/org/apache/ignite/internal/network/serialization/ClassDescriptor.java
##########
@@ -70,6 +71,23 @@
     /** Total number of non-primitive fields. */
     private final int objectFieldsCount;
 
+    /**
+     * Size of the nulls bitmap for the described class; it is equal to the number of nullable (i.e. non-primitive)
+     * fields that have a type known upfront.
+     *
+     * @see #fieldNullsBitmapIndices
+     * @see #isValueTypeKnownUpfront()
+     */
+    private final int fieldNullsBitmapSize;
+    /**

Review comment:
       Missing newline? Or is it optional 

##########
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:
       ```suggestion
       private boolean specificTypeIsKnownUpfront(@Nullable Class<?> declaredClass) {
   ```
   Concrete is a building material :)




-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org