Replace Collections.unmodifiableList(new ArrayList(..)) with List.copyOf() (#30166)

This commit is contained in:
SW
2023-04-12 20:07:20 +09:00
committed by GitHub
parent 695601aa06
commit 59c65fa940
4 changed files with 4 additions and 7 deletions

View File

@@ -17,7 +17,6 @@
package org.springframework.messaging.handler.annotation.reactive;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -93,7 +92,7 @@ public class PayloadMethodArgumentResolver implements HandlerMethodArgumentResol
@Nullable ReactiveAdapterRegistry registry, boolean useDefaultResolution) {
Assert.isTrue(!CollectionUtils.isEmpty(decoders), "At least one Decoder is required");
this.decoders = Collections.unmodifiableList(new ArrayList<>(decoders));
this.decoders = List.copyOf(decoders);
this.validator = validator;
this.adapterRegistry = registry != null ? registry : ReactiveAdapterRegistry.getSharedInstance();
this.useDefaultResolution = useDefaultResolution;

View File

@@ -16,7 +16,6 @@
package org.springframework.messaging.rsocket;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
@@ -73,7 +72,7 @@ public class DefaultMetadataExtractor implements MetadataExtractor, MetadataExtr
* Constructor with list of decoders for de-serializing metadata entries.
*/
public DefaultMetadataExtractor(List<Decoder<?>> decoders) {
this.decoders = Collections.unmodifiableList(new ArrayList<>(decoders));
this.decoders = List.copyOf(decoders);
}