Copy an immutable collection that is mutated

Proprietary

A local initialized by List.of(..), Set.of(..), Map.of(..), their copyOf(..), or an empty or singleton factory of Collections, and then changed, starts from an ArrayList, HashSet or HashMap copy instead, so the change no longer throws UnsupportedOperationException. It is left alone when it leaves its method, when that exception may be expected, or when a null query or iteration order could tell the copy apart.

io.moderne.staticanalysis.CopyMutatedImmutableCollection
mod run . --recipe=io.moderne.staticanalysis.CopyMutatedImmutableCollection

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.