From 555b3f12eef5e3ec06c84c332db6612522b7c2b2 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 17 Mar 2017 19:10:28 +0300 Subject: [PATCH] Use LinkedHashSet instead of HashSet in DataFlowInfo.getCollectedTypes This fixes DiagnosticsTestGenerated$Tests.testImplicitIntersection, which began to fail after update to JDK 8 because the iteration order of HashMap/HashSet has changed in JDK 8: http://openjdk.java.net/jeps/180 http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/43bd5ee0205e --- .../calls/smartcasts/DelegatingDataFlowInfo.kt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt index c197ba2c11d..30c19e106fe 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/smartcasts/DelegatingDataFlowInfo.kt @@ -20,15 +20,14 @@ import com.google.common.collect.* import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.config.LanguageFeature import org.jetbrains.kotlin.config.LanguageVersionSettings -import org.jetbrains.kotlin.types.* +import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability.NOT_NULL import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeUtils -import org.jetbrains.kotlin.types.typeUtil.* - +import org.jetbrains.kotlin.types.isFlexible +import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf +import org.jetbrains.kotlin.utils.newLinkedHashSetWithExpectedSize import java.util.* -import org.jetbrains.kotlin.resolve.calls.smartcasts.Nullability.NOT_NULL - internal class DelegatingDataFlowInfo private constructor( private val parent: DataFlowInfo?, private val nullabilityInfo: ImmutableMap, @@ -121,7 +120,7 @@ internal class DelegatingDataFlowInfo private constructor( return types } - val enrichedTypes = Sets.newHashSetWithExpectedSize(types.size + 1) + val enrichedTypes = newLinkedHashSetWithExpectedSize(types.size + 1) val originalType = key.type if (originalType.isMarkedNullable) { enrichedTypes.add(TypeUtils.makeNotNullable(originalType))