Skip to content

Commit

Permalink
[JBMAR-194] Increase potential serialization density by allowing obje…
Browse files Browse the repository at this point in the history
…ct table substitution of class descriptor components
  • Loading branch information
dmlloyd committed Apr 19, 2017
1 parent 28c4b75 commit 38e0028
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Expand Up @@ -1481,7 +1481,12 @@ protected void writeNewSerializableClass(final Class<?> objClass) throws IOExcep
} else {
write(ID_SERIALIZABLE_CLASS);
}
writeString(classResolver.getClassName(objClass));
final String className = classResolver.getClassName(objClass);
if (configuredVersion >= 4) {
writeObject(className);
} else {
writeString(className);
}
writeLong(info.getEffectiveSerialVersionUID());
classCache.put(objClass, classSeq++);
classResolver.annotateClass(this, objClass);
Expand All @@ -1490,7 +1495,11 @@ protected void writeNewSerializableClass(final Class<?> objClass) throws IOExcep
writeInt(cnt);
for (int i = 0; i < cnt; i++) {
SerializableField field = fields[i];
writeUTF(field.getName());
if (configuredVersion >= 4) {
writeObject(field.getName());
} else {
writeUTF(field.getName());
}
try {
writeClass(field.getKind() == Kind.OBJECT ? Object.class : field.getType());
} catch (ClassNotFoundException e) {
Expand Down
Expand Up @@ -1018,7 +1018,7 @@ ClassDescriptor doReadClassDescriptor(final int classType, final boolean require
case ID_SERIALIZABLE_CLASS: {
int idx = classCache.size();
classCache.add(null);
final String className = readString();
final String className = configuredVersion >= 4 ? readObject(String.class) : readString();
final long uid = readLong();
Class<?> clazz = null;
try {
Expand All @@ -1033,7 +1033,7 @@ ClassDescriptor doReadClassDescriptor(final int classType, final boolean require
final ClassDescriptor[] descriptors = new ClassDescriptor[cnt];
final boolean[] unshareds = new boolean[cnt];
for (int i = 0; i < cnt; i ++) {
names[i] = readUTF();
names[i] = configuredVersion >= 4 ? readObject(String.class) : readUTF();
descriptors[i] = doReadClassDescriptor(readUnsignedByte(), true);
unshareds[i] = readBoolean();
}
Expand Down

0 comments on commit 38e0028

Please sign in to comment.