LiangliangSui commented on code in PR #1667:
URL: https://github.com/apache/incubator-fury/pull/1667#discussion_r1623416961


##########
java/fury-core/src/main/java/org/apache/fury/resolver/ClassInfo.java:
##########
@@ -86,14 +85,19 @@ public class ClassInfo {
     } else {
       this.fullClassNameBytes = null;
     }
+    // When `classId == ClassResolver.REPLACE_STUB_ID` was established,
+    // means only classes are serialized, not the instance. If we
+    // serialize such class only, we need to write classname bytes.
     if (cls != null
-        && (classId == ClassResolver.NO_CLASS_ID || classId == 
ClassResolver.REPLACE_STUB_ID)) {
+        && ((classId == ClassResolver.NO_CLASS_ID
+                && !classResolver.getFury().getConfig().isMetaShareEnabled())
+            || classId == ClassResolver.REPLACE_STUB_ID)) {
       // REPLACE_STUB_ID for write replace class in `ClassSerializer`.
       Tuple2<String, String> tuple2 = Encoders.encodePkgAndClass(cls);
       this.packageNameBytes =
-          
metaStringResolver.getOrCreateMetaStringBytes(PACKAGE_ENCODER.encode(tuple2.f0));
+          
metaStringResolver.getOrCreateMetaStringBytes(Encoders.encodePackage(tuple2.f0));
       this.classNameBytes =
-          
metaStringResolver.getOrCreateMetaStringBytes(TYPE_NAME_ENCODER.encode(tuple2.f1));
+          
metaStringResolver.getOrCreateMetaStringBytes(Encoders.encodeTypeName(tuple2.f1));

Review Comment:
   And `MetaStringEncoder` supports UTF8 by default, even if my `EncodingSet` 
does not specify UTF8



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