carterkozak commented on a change in pull request #471:
URL: https://github.com/apache/logging-log4j2/pull/471#discussion_r585008161



##########
File path: 
log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterFormatter.java
##########
@@ -538,24 +536,28 @@ private static void appendArray(final Object o, final 
StringBuilder str, Set<Str
                     } else {
                         str.append(", ");
                     }
-                    recursiveDeepToString(current, str, new HashSet<>(dejaVu));
+                    recursiveDeepToString(current, str, effectiveDejaVu);

Review comment:
       By removing the `new HashSet` as we traverse the collection, I think we 
end up producing potentially confusing data. I think we may want to keep the 
collection creation despite the additional allocation cost.
   
   We should add tests for this case ;-)
   
   Consider `[Foo{A}, Foo{A}]`. It duplicates data, however it's not recursive. 
We only want to catch cycles here, not duplication, e.g. `A=[Foo{B}, A]` if 
that makes sense. What do you think?
   
   edit: clearer example, hopefully




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to