chaokunyang commented on code in PR #2036:
URL: https://github.com/apache/fury/pull/2036#discussion_r2051406699


##########
java/fury-core/src/main/java/org/apache/fury/serializer/ObjectSerializer.java:
##########
@@ -495,104 +548,165 @@ static boolean writePrimitiveFieldValueFailed(
    * @return true if field value isn't written by this function.
    */
   static boolean writeBasicObjectFieldValueFailed(
-      Fury fury, MemoryBuffer buffer, Object fieldValue, short classId) {
+      Fury fury,
+      MemoryBuffer buffer,
+      Object fieldValue,
+      short classId,
+      FuryFieldAnnotationInfo fieldAnnotationInfo) {
     if (!fury.isBasicTypesRefIgnored()) {
       return true; // let common path handle this.
     }
+    boolean nullable = fieldAnnotationInfo.nullable;
     // add time types serialization here.
     switch (classId) {
-      case ClassResolver.STRING_CLASS_ID: // fastpath for string.
-        fury.writeJavaStringRef(buffer, (String) (fieldValue));
+      case ClassResolver.STRING_CLASS_ID: // fast path for string.
+        fury.writeNullableJavaStringRef(buffer, (String) (fieldValue), 
nullable);

Review Comment:
   This makes writeNullableJavaStringRef too complicated. How about:
   
   ```java 
   {
   String v =  (String) (fieldValue);
   if (nullable) {
     fury.writeJavaStringRef(buffer, v);
   } else {
     fury.writeString(buffer, v);
   }
   return false;
   }
   ```



-- 
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]

Reply via email to