diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/EntityWasGarbageCollectedException.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/EntityWasGarbageCollectedException.kt index 0f70622df82..3662f6903d2 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/EntityWasGarbageCollectedException.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/EntityWasGarbageCollectedException.kt @@ -5,6 +5,6 @@ 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" } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/ReadOnlyWeakRef.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/ReadOnlyWeakRef.kt index 1b82d60cf34..74d9da319ad 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/ReadOnlyWeakRef.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/utils/ReadOnlyWeakRef.kt @@ -18,7 +18,7 @@ constructor(value: V, val token: ValidityToken) { @Suppress("NOTHING_TO_INLINE") inline operator fun getValue(thisRef: Any, property: KProperty<*>): V = weakRef.get() ?: if (token.isValid()) { - error("Value of $property was garbage collected while analysis session is still valid") + throw EntityWasGarbageCollectedException(property.toString()) } else { error("Accessing the invalid value of $property") }