DelegatingDataFlowInfo: potential concurrent modification in multi map fixed
This commit is contained in:
+6
-4
@@ -297,16 +297,18 @@ internal class DelegatingDataFlowInfo private constructor(
|
|||||||
typeInfo: SetMultimap<DataFlowValue, KotlinType>,
|
typeInfo: SetMultimap<DataFlowValue, KotlinType>,
|
||||||
valueWithGivenTypeInfo: DataFlowValue? = null
|
valueWithGivenTypeInfo: DataFlowValue? = null
|
||||||
): DataFlowInfo {
|
): DataFlowInfo {
|
||||||
|
val toDelete = newTypeInfo()
|
||||||
for (value in typeInfo.keys()) {
|
for (value in typeInfo.keys()) {
|
||||||
var iterator = typeInfo[value].iterator()
|
for (type in typeInfo[value]) {
|
||||||
while (iterator.hasNext()) {
|
|
||||||
val type = iterator.next()
|
|
||||||
// Remove original type and for not flexible type also all its supertypes (see also KT-10666)
|
// Remove original type and for not flexible type also all its supertypes (see also KT-10666)
|
||||||
if (if (value.type.isFlexible()) value.type == type else value.type.isSubtypeOf(type)) {
|
if (if (value.type.isFlexible()) value.type == type else value.type.isSubtypeOf(type)) {
|
||||||
iterator.remove()
|
toDelete.put(value, type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for ((value, type) in toDelete.entries()) {
|
||||||
|
typeInfo.remove(value, type)
|
||||||
|
}
|
||||||
if (nullabilityInfo.isEmpty() && typeInfo.isEmpty && valueWithGivenTypeInfo == null) {
|
if (nullabilityInfo.isEmpty() && typeInfo.isEmpty && valueWithGivenTypeInfo == null) {
|
||||||
return parent ?: DataFlowInfoFactory.EMPTY
|
return parent ?: DataFlowInfoFactory.EMPTY
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user