Issue #8984 Fix dump of Attributes (#9024)

This commit is contained in:
Jan Bartel 2022-12-09 09:48:55 +11:00 committed by GitHub
parent 6c6955943f
commit 642d983e01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -101,12 +101,14 @@ public interface Dumpable
s = StringUtil.replace(s, "\r\n", "|");
s = StringUtil.replace(s, '\n', '|');
}
else if (o instanceof Collection)
s = String.format("%s@%x(size=%d)", TypeUtil.toShortName(o.getClass()), o.hashCode(), ((Collection)o).size());
else if (o instanceof Collection collection)
s = String.format("%s@%x(size=%d)", TypeUtil.toShortName(o.getClass()), o.hashCode(), collection.size());
else if (o.getClass().isArray())
s = String.format("%s@%x[size=%d]", o.getClass().getComponentType(), o.hashCode(), Array.getLength(o));
else if (o instanceof Map)
s = String.format("%s@%x{size=%d}", TypeUtil.toShortName(o.getClass()), o.hashCode(), ((Map<?, ?>)o).size());
else if (o instanceof Map map)
s = String.format("%s@%x{size=%d}", TypeUtil.toShortName(o.getClass()), o.hashCode(), map.size());
else if (o instanceof Map.Entry<?, ?> entry)
s = String.format("%s=%s", entry.getKey(), entry.getValue());
else
{
s = String.valueOf(o);
@ -161,7 +163,7 @@ public interface Dumpable
{
dumpMapEntries(out, indent, (Map<?, ?>)object, extras == 0);
}
if (extras == 0)
return;