chaokunyang commented on code in PR #1667:
URL: https://github.com/apache/incubator-fury/pull/1667#discussion_r1623918682
##########
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:
I misunderstood it. `Encoders.encodePkgName` use `UTF_8,
ALL_TO_LOWER_SPECIAL, LOWER_UPPER_DIGIT_SPECIAL` encoding. The
`ClassDefEncoder` use index in `UTF_8, ALL_TO_LOWER_SPECIAL,
LOWER_UPPER_DIGIT_SPECIAL` to store encoding. But `getOrCreateMetaStringBytes`
uses the encoding in returned `MetaString` instead, so it will use
`metaString.getEncoding().getValue()` as the index, and there won't be
inconsistency when decoding the meta string
--
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]