Rename buildErrorWithAttachment -> errorWithAttachment to emphasise the similar semantics to kotlin.error
This commit is contained in:
committed by
Space Team
parent
e3c31e1387
commit
2d791eb292
+4
-4
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withConeTypeEntry
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirSymbolEntry
|
||||
import org.jetbrains.kotlin.analysis.providers.KotlinPackageProvider
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
@@ -583,19 +583,19 @@ internal class KtSymbolByFirBuilder constructor(
|
||||
|
||||
companion object {
|
||||
private fun throwUnexpectedElementError(element: FirBasedSymbol<*>): Nothing {
|
||||
buildErrorWithAttachment("Unexpected ${element::class.simpleName}") {
|
||||
errorWithAttachment("Unexpected ${element::class.simpleName}") {
|
||||
withFirSymbolEntry("firSymbol", element)
|
||||
}
|
||||
}
|
||||
|
||||
private fun throwUnexpectedElementError(element: FirElement): Nothing {
|
||||
buildErrorWithAttachment("Unexpected ${element::class.simpleName}") {
|
||||
errorWithAttachment("Unexpected ${element::class.simpleName}") {
|
||||
withFirEntry("firElement", element)
|
||||
}
|
||||
}
|
||||
|
||||
private fun throwUnexpectedElementError(element: ConeKotlinType): Nothing {
|
||||
buildErrorWithAttachment("Unexpected ${element::class.simpleName}") {
|
||||
errorWithAttachment("Unexpected ${element::class.simpleName}") {
|
||||
withConeTypeEntry("coneType", element)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolWithKind
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.llFirSession
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.originalDeclaration
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.parentOfType
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol
|
||||
import org.jetbrains.kotlin.fir.diagnostics.ConeDestructuringDeclarationsOnTopLevel
|
||||
@@ -87,7 +87,7 @@ internal class KtFirSymbolContainingDeclarationProvider(
|
||||
private fun getContainingPsi(symbol: KtSymbol): KtDeclaration {
|
||||
val source = symbol.firSymbol.source
|
||||
val thisSource = when (source?.kind) {
|
||||
null -> buildErrorWithAttachment("PSI should present for declaration built by Kotlin code") {
|
||||
null -> errorWithAttachment("PSI should present for declaration built by Kotlin code") {
|
||||
withSymbolAttachment("symbolForContainingPsi", symbol, analysisSession)
|
||||
}
|
||||
|
||||
@@ -96,19 +96,19 @@ internal class KtFirSymbolContainingDeclarationProvider(
|
||||
KtFakeSourceElementKind.EnumInitializer -> return source.psi as KtEnumEntry
|
||||
KtRealSourceElementKind -> source.psi!!
|
||||
else ->
|
||||
buildErrorWithAttachment("errorWithAttachment FirSourceElement: kind=${source.kind} element=${source.psi!!::class.simpleName}") {
|
||||
errorWithAttachment("errorWithAttachment FirSourceElement: kind=${source.kind} element=${source.psi!!::class.simpleName}") {
|
||||
withSymbolAttachment("symbolForContainingPsi", symbol, analysisSession)
|
||||
}
|
||||
}
|
||||
|
||||
return when (symbol.origin) {
|
||||
KtSymbolOrigin.SOURCE -> thisSource.getContainingKtDeclaration()
|
||||
?: buildErrorWithAttachment("Containing declaration should present for non-toplevel declaration ${thisSource::class}") {
|
||||
?: errorWithAttachment("Containing declaration should present for non-toplevel declaration ${thisSource::class}") {
|
||||
withSymbolAttachment("symbolForContainingPsi", symbol, analysisSession)
|
||||
}
|
||||
|
||||
KtSymbolOrigin.SOURCE_MEMBER_GENERATED -> thisSource as KtDeclaration
|
||||
else -> buildErrorWithAttachment("Unsupported declaration origin ${symbol.origin} ${thisSource::class}") {
|
||||
else -> errorWithAttachment("Unsupported declaration origin ${symbol.origin} ${thisSource::class}") {
|
||||
withSymbolAttachment("symbolForContainingPsi", symbol, analysisSession)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.analysis.api.symbols.KtSymbolOrigin
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KtSymbolKind
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.errorWithFirSpecificEntries
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.fir.containingClassForLocalAttr
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
|
||||
@@ -70,7 +70,7 @@ internal tailrec fun FirDeclaration.ktSymbolOrigin(): KtSymbolOrigin = when (ori
|
||||
this is FirValueParameter && this.containingFunctionSymbol.origin == FirDeclarationOrigin.Synthetic -> KtSymbolOrigin.SOURCE_MEMBER_GENERATED
|
||||
this is FirSyntheticProperty || this is FirSyntheticPropertyAccessor -> KtSymbolOrigin.JAVA_SYNTHETIC_PROPERTY
|
||||
|
||||
else -> buildErrorWithAttachment("Invalid FirDeclarationOrigin ${origin::class.simpleName}") {
|
||||
else -> errorWithAttachment("Invalid FirDeclarationOrigin ${origin::class.simpleName}") {
|
||||
withFirEntry("firToGetOrigin", this@ktSymbolOrigin)
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ internal tailrec fun FirDeclaration.ktSymbolOrigin(): KtSymbolOrigin = when (ori
|
||||
|
||||
FirDeclarationOrigin.ImportedFromObjectOrStatic -> {
|
||||
val importedFromObjectData = (this as FirCallableDeclaration).importedFromObjectOrStaticData
|
||||
?: buildErrorWithAttachment("Declaration has ImportedFromObject origin, but no importedFromObjectData present") {
|
||||
?: errorWithAttachment("Declaration has ImportedFromObject origin, but no importedFromObjectData present") {
|
||||
withFirEntry("firToGetOrigin", this@ktSymbolOrigin)
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ internal tailrec fun FirDeclaration.ktSymbolOrigin(): KtSymbolOrigin = when (ori
|
||||
is FirDeclarationOrigin.Plugin -> KtSymbolOrigin.PLUGIN
|
||||
FirDeclarationOrigin.RenamedForOverride -> KtSymbolOrigin.JAVA
|
||||
is FirDeclarationOrigin.SubstitutionOverride -> KtSymbolOrigin.SUBSTITUTION_OVERRIDE
|
||||
FirDeclarationOrigin.DynamicScope -> buildErrorWithAttachment("Invalid FirDeclarationOrigin ${origin::class.simpleName}") {
|
||||
FirDeclarationOrigin.DynamicScope -> errorWithAttachment("Invalid FirDeclarationOrigin ${origin::class.simpleName}") {
|
||||
withFirEntry("firToGetOrigin", this@ktSymbolOrigin)
|
||||
}
|
||||
FirDeclarationOrigin.ScriptCustomization -> KtSymbolOrigin.PLUGIN
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.api.resolveToFirSymbolOfT
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirElementError
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.errorWithFirSpecificEntries
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirSymbolEntry
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.withPsiEntry
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclarationOrigin
|
||||
import org.jetbrains.kotlin.fir.declarations.fullyExpandedClass
|
||||
@@ -71,7 +71,7 @@ internal class KtFirSymbolProvider(
|
||||
}
|
||||
|
||||
is FirAnonymousFunctionSymbol -> firSymbolBuilder.functionLikeBuilder.buildAnonymousFunctionSymbol(firSymbol)
|
||||
else -> buildErrorWithAttachment("Unexpected ${firSymbol::class}") {
|
||||
else -> errorWithAttachment("Unexpected ${firSymbol::class}") {
|
||||
withFirSymbolEntry("firSymbol", firSymbol)
|
||||
withPsiEntry("function", psi, analysisSession::getModule)
|
||||
}
|
||||
@@ -141,7 +141,7 @@ internal class KtFirSymbolProvider(
|
||||
private fun KtClassOrObject.resolveToFirClassLikeSymbol(): FirClassSymbol<*> {
|
||||
return when (val firClassLike = resolveToFirSymbolOfType<FirClassLikeSymbol<*>>(firResolveSession)) {
|
||||
is FirTypeAliasSymbol -> firClassLike.fullyExpandedClass(analysisSession.useSiteSession)
|
||||
?: buildErrorWithAttachment("${firClassLike.fir::class} should be expanded to the expected type alias") {
|
||||
?: errorWithAttachment("${firClassLike.fir::class} should be expanded to the expected type alias") {
|
||||
val errorElement = this@resolveToFirClassLikeSymbol
|
||||
withFirSymbolEntry("firClassLikeSymbol", firClassLike)
|
||||
withPsiEntry("ktClassOrObject", errorElement, analysisSession::getModule)
|
||||
|
||||
+2
-2
@@ -5,10 +5,10 @@
|
||||
|
||||
package org.jetbrains.kotlin.analysis.utils.errors
|
||||
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
|
||||
public fun unexpectedElementError(elementName: String, element: Any?): Nothing {
|
||||
buildErrorWithAttachment("Unexpected $elementName ${element?.let { it::class.simpleName }}") {
|
||||
errorWithAttachment("Unexpected $elementName ${element?.let { it::class.simpleName }}") {
|
||||
withEntry(elementName, element) { element.toString() }
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.util.FirElementFinder
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.containingClass
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.getContainingFile
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.checkWithAttachmentBuilder
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.requireIsInstance
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.unexpectedElementError
|
||||
@@ -240,19 +240,19 @@ private fun findKotlinStdlibClass(classId: ClassId, target: FirDeclaration): Fir
|
||||
}
|
||||
|
||||
fun FirElementWithResolveState.collectDesignation(firFile: FirFile): FirDesignationWithFile =
|
||||
tryCollectDesignation(firFile) ?: buildErrorWithAttachment("No designation of local declaration") {
|
||||
tryCollectDesignation(firFile) ?: errorWithAttachment("No designation of local declaration") {
|
||||
withFirEntry("firFile", firFile)
|
||||
}
|
||||
|
||||
fun FirElementWithResolveState.collectDesignation(): FirDesignation =
|
||||
tryCollectDesignation()
|
||||
?: buildErrorWithAttachment("No designation of local declaration") {
|
||||
?: errorWithAttachment("No designation of local declaration") {
|
||||
withFirEntry("FirDeclaration", this@collectDesignation)
|
||||
}
|
||||
|
||||
fun FirElementWithResolveState.collectDesignationWithFile(): FirDesignationWithFile =
|
||||
tryCollectDesignationWithFile()
|
||||
?: buildErrorWithAttachment("No designation of local declaration") {
|
||||
?: errorWithAttachment("No designation of local declaration") {
|
||||
withFirEntry("FirDeclaration", this@collectDesignationWithFile)
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirResolvableReso
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.FirElementFinder
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.errorWithFirSpecificEntries
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.originalDeclaration
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.withPsiEntry
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.parentOfType
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.parentsOfType
|
||||
@@ -187,7 +187,7 @@ object LowLevelFirApiFacadeForResolveOnAir {
|
||||
}
|
||||
|
||||
val originalNonLocalDeclaration = PsiTreeUtil.findSameElementInCopy(copiedNonLocalDeclaration, originalKtFile)
|
||||
?: buildErrorWithAttachment("Cannot find original function matching") {
|
||||
?: errorWithAttachment("Cannot find original function matching") {
|
||||
withPsiEntry("matchingPsi", elementToAnalyze, originalFirResolveSession::getModule)
|
||||
withPsiEntry("originalFile", originalKtFile, originalFirResolveSession::getModule)
|
||||
}
|
||||
@@ -228,7 +228,7 @@ object LowLevelFirApiFacadeForResolveOnAir {
|
||||
}
|
||||
|
||||
val llFirResolvableSession = firFile.llFirResolvableSession
|
||||
?: buildErrorWithAttachment("FirFile session expected to be a resolvable session but was ${firFile.llFirSession::class.java}") {
|
||||
?: errorWithAttachment("FirFile session expected to be a resolvable session but was ${firFile.llFirSession::class.java}") {
|
||||
withEntry("firSession", firFile.llFirSession) { it.toString() }
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.KtSourceElement
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignation
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.project.structure.llFirModuleData
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.errorWithFirSpecificEntries
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.requireIsInstance
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.withPsiEntry
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
@@ -188,7 +188,7 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
): ConstructorConversionParams {
|
||||
val typeParameters = mutableListOf<FirTypeParameterRef>()
|
||||
context.appendOuterTypeParameters(ignoreLastLevel = false, typeParameters)
|
||||
val containingClass = this.containingClass ?: buildErrorWithAttachment("Constructor outside of class") {
|
||||
val containingClass = this.containingClass ?: errorWithAttachment("Constructor outside of class") {
|
||||
withPsiEntry("constructor", constructor, baseSession.llFirModuleData.ktModule)
|
||||
}
|
||||
val selfType = classOrObject.toDelegatedSelfType(typeParameters, containingClass.symbol)
|
||||
@@ -201,7 +201,7 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
val classOrObject = constructor.getContainingClassOrObject()
|
||||
val params = extractContructorConversionParams(classOrObject, constructor)
|
||||
val delegatedTypeRef = (originalDeclaration as FirConstructor).delegatedConstructor?.constructedTypeRef
|
||||
?: buildErrorWithAttachment("Secondary constructor without delegated call") {
|
||||
?: errorWithAttachment("Secondary constructor without delegated call") {
|
||||
withPsiEntry("constructor", constructor, baseSession.llFirModuleData.ktModule)
|
||||
}
|
||||
return constructor.toFirConstructor(
|
||||
@@ -253,7 +253,7 @@ internal class RawFirNonLocalDeclarationBuilder private constructor(
|
||||
processPrimaryConstructor(constructor.getContainingClassOrObject(), constructor)
|
||||
|
||||
override fun visitEnumEntry(enumEntry: KtEnumEntry, data: FirElement?): FirElement {
|
||||
val owner = containingClass ?: buildErrorWithAttachment("Enum entry outside of class") {
|
||||
val owner = containingClass ?: errorWithAttachment("Enum entry outside of class") {
|
||||
withPsiEntry("enumEntry", enumEntry, baseSession.llFirModuleData.ktModule)
|
||||
}
|
||||
val classOrObject = owner.psi as KtClassOrObject
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||
import org.jetbrains.kotlin.analysis.utils.classIdIfNonLocal
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.checkWithAttachmentBuilder
|
||||
|
||||
class LLFirFirClassByPsiClassProvider(private val session: LLFirSession) : FirSessionComponent {
|
||||
@@ -71,7 +71,7 @@ class LLFirFirClassByPsiClassProvider(private val session: LLFirSession) : FirSe
|
||||
?: error("No classId for non-local class")
|
||||
val provider = session.nullableJavaSymbolProvider ?: session.symbolProvider
|
||||
val symbol = provider.getClassLikeSymbolByClassId(classId)
|
||||
?: buildErrorWithAttachment("No classifier found") {
|
||||
?: errorWithAttachment("No classifier found") {
|
||||
withPsiEntry("psiClass", psiClass, session.ktModule)
|
||||
withEntry("classId", classId) { it.asString() }
|
||||
}
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.util.*
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.FirDeclarationForCompiledElementSearcher
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.findSourceNonLocalFirDeclaration
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.requireIsInstance
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.withPsiEntry
|
||||
import org.jetbrains.kotlin.analysis.utils.printer.getElementTextInContext
|
||||
@@ -133,7 +133,7 @@ internal abstract class LLFirResolvableResolveSession(
|
||||
}
|
||||
|
||||
val nonLocalDeclaration = ktDeclaration.getNonLocalContainingOrThisDeclaration()
|
||||
?: buildErrorWithAttachment("Declaration should have non-local container") {
|
||||
?: errorWithAttachment("Declaration should have non-local container") {
|
||||
withPsiEntry("ktDeclaration", ktDeclaration, ::getModule)
|
||||
withEntry("module", module) { it.moduleDescription }
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirEle
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkDelegatedConstructorIsResolved
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.*
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.checkWithAttachmentBuilder
|
||||
import org.jetbrains.kotlin.fir.FirElementWithResolveState
|
||||
import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer
|
||||
@@ -113,7 +113,7 @@ private class LLFirBodyTargetResolver(
|
||||
val dataFlowAnalyzer = transformer.declarationsTransformer.dataFlowAnalyzer
|
||||
dataFlowAnalyzer.enterClass(target, buildGraph = true)
|
||||
val controlFlowGraph = dataFlowAnalyzer.exitClass()
|
||||
?: buildErrorWithAttachment("CFG should not be 'null' as 'buildGraph' is specified") {
|
||||
?: errorWithAttachment("CFG should not be 'null' as 'buildGraph' is specified") {
|
||||
withFirEntry("firClass", target)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.project.structure.llFirMo
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.llFirSession
|
||||
import org.jetbrains.kotlin.analysis.project.structure.ProjectStructureProvider
|
||||
import org.jetbrains.kotlin.utils.exceptions.ExceptionAttachmentBuilder
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.withKtModuleEntry
|
||||
import org.jetbrains.kotlin.analysis.utils.errors.withPsiEntry
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
@@ -60,7 +60,7 @@ fun errorWithFirSpecificEntries(
|
||||
psi: PsiElement? = null,
|
||||
additionalInfos: ExceptionAttachmentBuilder.() -> Unit = {}
|
||||
): Nothing {
|
||||
buildErrorWithAttachment(message, cause) {
|
||||
errorWithAttachment(message, cause) {
|
||||
if (fir != null) {
|
||||
withFirEntry("fir", fir)
|
||||
}
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer
|
||||
import org.jetbrains.kotlin.analysis.api.types.*
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
||||
import org.jetbrains.kotlin.analysis.providers.createProjectWideOutOfBlockModificationTracker
|
||||
import org.jetbrains.kotlin.utils.exceptions.buildErrorWithAttachment
|
||||
import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightElement
|
||||
import org.jetbrains.kotlin.asJava.elements.KtLightMember
|
||||
import org.jetbrains.kotlin.asJava.elements.psiType
|
||||
@@ -278,7 +278,7 @@ internal fun BitSet.copy(): BitSet = clone() as BitSet
|
||||
context(KtAnalysisSession)
|
||||
internal fun <T : KtSymbol> KtSymbolPointer<T>.restoreSymbolOrThrowIfDisposed(): T =
|
||||
restoreSymbol()
|
||||
?: buildErrorWithAttachment("${this::class} pointer already disposed") {
|
||||
?: errorWithAttachment("${this::class} pointer already disposed") {
|
||||
withEntry("pointer", this@restoreSymbolOrThrowIfDisposed) { it.toString() }
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -58,7 +58,7 @@ inline fun KotlinExceptionWithAttachments.buildAttachment(
|
||||
return withAttachment(name, ExceptionAttachmentBuilder().apply(buildContent).buildString())
|
||||
}
|
||||
|
||||
inline fun buildErrorWithAttachment(
|
||||
inline fun errorWithAttachment(
|
||||
message: String,
|
||||
cause: Exception? = null,
|
||||
attachmentName: String = "info.txt",
|
||||
@@ -86,7 +86,7 @@ inline fun rethrowExceptionWithDetails(
|
||||
buildAttachment: ExceptionAttachmentBuilder.() -> Unit = {},
|
||||
): Nothing {
|
||||
if (shouldIjPlatformExceptionBeRethrown(exception)) throw exception
|
||||
buildErrorWithAttachment(message, exception, attachmentName, buildAttachment)
|
||||
errorWithAttachment(message, exception, attachmentName, buildAttachment)
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ inline fun checkWithAttachmentBuilder(
|
||||
contract { returns() implies (condition) }
|
||||
|
||||
if (!condition) {
|
||||
buildErrorWithAttachment(message(), buildAttachment = buildAttachment)
|
||||
errorWithAttachment(message(), buildAttachment = buildAttachment)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,6 @@ inline fun requireWithAttachmentBuilder(
|
||||
contract { returns() implies (condition) }
|
||||
|
||||
if (!condition) {
|
||||
buildErrorWithAttachment(message(), buildAttachment = buildAttachment)
|
||||
errorWithAttachment(message(), buildAttachment = buildAttachment)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user