[FIR] Store cachedExpandedType in WeakPair instead of usual Pair

WeakPair is a renamed OneElementWeakMap
This commit is contained in:
Dmitriy Novozhilov
2021-04-13 18:10:12 +03:00
parent dd96c3b56e
commit 7c6a9aa963
6 changed files with 41 additions and 29 deletions
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.symbols.impl
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag
import org.jetbrains.kotlin.fir.utils.WeakPair
import org.jetbrains.kotlin.name.ClassId
@RequiresOptIn
@@ -19,7 +20,7 @@ class ConeClassLikeLookupTagImpl(override val classId: ClassId) : ConeClassLikeL
}
@LookupTagInternals
var boundSymbol: OneElementWeakMap<FirSession, FirClassLikeSymbol<*>?>? = null
var boundSymbol: WeakPair<FirSession, FirClassLikeSymbol<*>?>? = null
override fun equals(other: Any?): Boolean {
if (this === other) return true
@@ -1,21 +0,0 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.symbols.impl
import java.lang.ref.WeakReference
class OneElementWeakMap<K, V> private constructor(
private val keyReference: WeakReference<K>,
private val valueReference: WeakReference<V>
) {
constructor(key: K, value: V) : this(WeakReference(key), WeakReference(value))
val key: K?
get() = keyReference.get()
val value: V?
get() = valueReference.get()
}