chaokunyang commented on code in PR #1569:
URL: https://github.com/apache/incubator-fury/pull/1569#discussion_r1580450882


##########
java/fury-core/src/main/java/org/apache/fury/resolver/ClassInfo.java:
##########
@@ -85,13 +91,31 @@ public class ClassInfo {
         && (classId == ClassResolver.NO_CLASS_ID || classId == 
ClassResolver.REPLACE_STUB_ID)) {
       // REPLACE_STUB_ID for write replace class in `ClassSerializer`.
       String packageName = ReflectionUtils.getPackage(cls);
+      String className = ReflectionUtils.getClassNameWithoutPackage(cls);
+      if (cls.isArray()) {
+        Tuple2<Class<?>, Integer> componentInfo = 
TypeUtils.getArrayComponentInfo(cls);
+        Class<?> ctype = componentInfo.f0;
+        if (!ctype.isPrimitive()) { // primitive array has special format like 
[[[III.
+          String componentName = ctype.getName();
+          packageName = ReflectionUtils.getPackage(componentName);
+          String componentSimpleName = 
ReflectionUtils.getClassNameWithoutPackage(componentName);
+          String prefix = StringUtils.repeat(ARRAY_PREFIX, componentInfo.f1);
+          if (ctype.isEnum()) {
+            className = prefix + ENUM_PREFIX + componentSimpleName;
+          } else {
+            className = prefix + componentSimpleName;
+          }
+        }
+      } else if (cls.isEnum()) {
+        packageName = ReflectionUtils.getPackage(cls);
+        className = ENUM_PREFIX + 
ReflectionUtils.getClassNameWithoutPackage(cls);
+      }
       this.packageNameBytes =
           metaStringResolver.getOrCreateMetaStringBytes(
               new MetaStringEncoder('.', '_').encode(packageName));
       this.classNameBytes =
           metaStringResolver.getOrCreateMetaStringBytes(
-              new MetaStringEncoder('_', '$')
-                  .encode(ReflectionUtils.getClassNameWithoutPackage(cls)));
+              new MetaStringEncoder('_', '$').encode(className));

Review Comment:
   I added static object in https://github.com/apache/incubator-fury/pull/1556, 
I can port it to this PR 



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