Fix use of java-19 api

This commit is contained in:
Lukas Rieger (Blue) 2024-05-22 16:03:58 +02:00
parent 8455b50fc3
commit 2c2d2f9227
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6

View File

@ -108,13 +108,13 @@ private void dumpInstance(Object instance, JsonWriter writer, Set<Object> alread
} }
if (!alreadyDumped.add(instance)) { if (!alreadyDumped.add(instance)) {
writer.value("<<" + Objects.toIdentityString(instance) + ">>"); writer.value("<<" + toIdentityString(instance) + ">>");
return; return;
} }
writer.beginObject(); writer.beginObject();
try { try {
String identityString = Objects.toIdentityString(instance); String identityString = toIdentityString(instance);
writer.name("#identity").value(identityString); writer.name("#identity").value(identityString);
if (instance instanceof Map<?, ?> map) { if (instance instanceof Map<?, ?> map) {
@ -208,6 +208,10 @@ private void dumpInstance(Object instance, JsonWriter writer, Set<Object> alread
} }
} }
private static String toIdentityString(Object instance) {
return instance.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(instance));
}
private void dumpAnnotatedInstance(Class<?> type, Object instance, JsonWriter writer, Set<Object> alreadyDumped) throws IOException { private void dumpAnnotatedInstance(Class<?> type, Object instance, JsonWriter writer, Set<Object> alreadyDumped) throws IOException {
DebugDump typedd = type.getAnnotation(DebugDump.class); DebugDump typedd = type.getAnnotation(DebugDump.class);