FIR IDE: use EntityWasGarbageCollectedException instead of ISE in ReadOnlyWeakRef
This commit is contained in:
+1
-1
@@ -5,6 +5,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.frontend.api.fir.utils
|
package org.jetbrains.kotlin.idea.frontend.api.fir.utils
|
||||||
|
|
||||||
internal class EntityWasGarbageCollectedException(entity: String) : IllegalStateException() {
|
class EntityWasGarbageCollectedException(entity: String) : IllegalStateException() {
|
||||||
override val message: String = "$entity was garbage collected while KtAnalysisSession session is still valid"
|
override val message: String = "$entity was garbage collected while KtAnalysisSession session is still valid"
|
||||||
}
|
}
|
||||||
+1
-1
@@ -18,7 +18,7 @@ constructor(value: V, val token: ValidityToken) {
|
|||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline operator fun getValue(thisRef: Any, property: KProperty<*>): V =
|
inline operator fun getValue(thisRef: Any, property: KProperty<*>): V =
|
||||||
weakRef.get() ?: if (token.isValid()) {
|
weakRef.get() ?: if (token.isValid()) {
|
||||||
error("Value of $property was garbage collected while analysis session is still valid")
|
throw EntityWasGarbageCollectedException(property.toString())
|
||||||
} else {
|
} else {
|
||||||
error("Accessing the invalid value of $property")
|
error("Accessing the invalid value of $property")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user