Seen in Spring 5.3.18. LinkedHashMap.keySet()
tends to return a java.util.LinkedHashMap$LinkedKeySet
instance, which is not serializable. This becomes a problem then when you e.g. try to propagate the NoUniqueBeanDefinitionException
error across a network boundary (our use case).
Wrapping these in HashSet
s seem like the simplest way around. The only other call site was passing in an Arrays.asList()
object, and asList
is explicitly defined to return a serializable list.
(If this change is considered good/safe, it would perhaps be worth back-porting this to the Spring 5 branch as well. It does indeed change the semantics, but it could also arguably be considered a back-port safe bug fix.)
Thanks for a great project! :pray:
Comment From: pivotal-cla
@perlun Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
Comment From: pivotal-cla
@perlun Thank you for signing the Contributor License Agreement!
Comment From: perlun
(Test failure seems unrelated to me. :thinking:)
Comment From: snicoll
Thanks again @perlun and that's a good catch. Rather than doing this at the caller level, I've fixed the exception itself so that it creates a copy of the collection. This is similar to what we do for arrays.