From b9e677fef4748ffef2cd0b5a8a56a90a4b3c076b Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Mon, 8 Feb 2016 19:30:01 +0300 Subject: [PATCH] Get rid of redundant Map copy --- .../kotlin/resolve/calls/model/ResolvedCallImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java index 73d3d2e1aa4..ecfde15fc81 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/model/ResolvedCallImpl.java @@ -41,10 +41,7 @@ import org.jetbrains.kotlin.types.KotlinType; import org.jetbrains.kotlin.types.TypeProjection; import org.jetbrains.kotlin.types.TypeSubstitutor; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.util.*; import static org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus.INCOMPLETE_TYPE_INFERENCE; import static org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus.UNKNOWN_STATUS; @@ -213,9 +210,11 @@ public class ResolvedCallImpl implements MutableRe valueArguments.put(substitutedVersion, entry.getValue()); } - Map originalArgumentToParameterMap = Maps.newLinkedHashMap(argumentToParameterMap); + Collection> unsubstitutedArgumentMappings = + new SmartList>(argumentToParameterMap.entrySet()); + argumentToParameterMap.clear(); - for (Map.Entry entry : originalArgumentToParameterMap.entrySet()) { + for (Map.Entry entry : unsubstitutedArgumentMappings) { ArgumentMatchImpl argumentMatch = entry.getValue(); ValueParameterDescriptor valueParameterDescriptor = argumentMatch.getValueParameter(); ValueParameterDescriptor substitutedVersion = substitutedParametersMap.get(valueParameterDescriptor.getOriginal());