Use mutable list to collect items from Stream for reversal.
>> There are no guarantees on the type, mutability, serializability, or thread-safety of the List returned `Collector.toList()` doesn't guarantee mutability, then passing it to `Collections.reverse()` is not safe. Signed-off-by: Yanming Zhou <zhouyanming@gmail.com> Closes #3304
This commit is contained in:
committed by
Mark Paluch
parent
5d5ef3602d
commit
6d50ccbe3d
@@ -133,7 +133,7 @@ public class CustomConversions {
|
||||
converterConfiguration.getStoreConversions(), converterConfiguration.getUserConverters()).stream()
|
||||
.filter(this::isSupportedConverter).filter(this::shouldRegister)
|
||||
.map(ConverterRegistrationIntent::getConverterRegistration).map(this::register).distinct()
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
Collections.reverse(registeredConverters);
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ public class ExtensionAwareEvaluationContextProvider implements EvaluationContex
|
||||
return extensions.stream()//
|
||||
.sorted(AnnotationAwareOrderComparator.INSTANCE)//
|
||||
.map(it -> new EvaluationContextExtensionAdapter(it, getOrCreateInformation(it))) //
|
||||
.collect(Collectors.toList());
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user