[PL] Drop useless KotlinIrLinkerInternalException
It only added a confusion, while in fact has no practical sense.
This commit is contained in:
committed by
Space Team
parent
850879375a
commit
0a38b29491
-9
@@ -1,9 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010-2021 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.ir.linkage
|
|
||||||
|
|
||||||
// Used to terminate linking process. Detailed linkage errors are reported separately to IrMessageLogger.
|
|
||||||
class KotlinIrLinkerInternalException : Exception("Kotlin IR Linker exception")
|
|
||||||
+7
-13
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.backend.common.serialization.IrModuleDeserializer
|
|||||||
import org.jetbrains.kotlin.backend.common.linkage.issues.PotentialConflictKind.*
|
import org.jetbrains.kotlin.backend.common.linkage.issues.PotentialConflictKind.*
|
||||||
import org.jetbrains.kotlin.backend.common.linkage.issues.PotentialConflictKind.Companion.mostSignificantConflictKind
|
import org.jetbrains.kotlin.backend.common.linkage.issues.PotentialConflictKind.Companion.mostSignificantConflictKind
|
||||||
import org.jetbrains.kotlin.backend.common.linkage.issues.PotentialConflictReason.Companion.mostSignificantConflictReasons
|
import org.jetbrains.kotlin.backend.common.linkage.issues.PotentialConflictReason.Companion.mostSignificantConflictReasons
|
||||||
import org.jetbrains.kotlin.ir.linkage.KotlinIrLinkerInternalException
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||||
@@ -20,21 +19,16 @@ import org.jetbrains.kotlin.utils.ResolvedDependencyId
|
|||||||
import org.jetbrains.kotlin.utils.ResolvedDependencyVersion
|
import org.jetbrains.kotlin.utils.ResolvedDependencyVersion
|
||||||
import kotlin.Comparator
|
import kotlin.Comparator
|
||||||
|
|
||||||
/**
|
abstract class KotlinIrLinkerIssue {
|
||||||
* TODO: Currently, [KotlinIrLinkerInternalException] is only needed to show the stacktrace to the user.
|
|
||||||
* If stacktrace is not needed it's enough to throw [CompilationErrorException] to interrupt the compilation process.
|
|
||||||
* But, probably, we don't even need to show the stacktrace, so we could probably get rid of [KotlinIrLinkerInternalException] at all.
|
|
||||||
*/
|
|
||||||
abstract class KotlinIrLinkerIssue(private val needStacktrace: Boolean) {
|
|
||||||
protected abstract val errorMessage: String
|
protected abstract val errorMessage: String
|
||||||
|
|
||||||
fun raiseIssue(messageLogger: IrMessageLogger): Nothing {
|
fun raiseIssue(messageLogger: IrMessageLogger): Nothing {
|
||||||
messageLogger.report(IrMessageLogger.Severity.ERROR, errorMessage, null)
|
messageLogger.report(IrMessageLogger.Severity.ERROR, errorMessage, null)
|
||||||
throw if (needStacktrace) KotlinIrLinkerInternalException() else CompilationErrorException()
|
throw CompilationErrorException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UnexpectedUnboundIrSymbols(unboundSymbols: Set<IrSymbol>, whenDetected: String) : KotlinIrLinkerIssue(needStacktrace = false) {
|
class UnexpectedUnboundIrSymbols(unboundSymbols: Set<IrSymbol>, whenDetected: String) : KotlinIrLinkerIssue() {
|
||||||
override val errorMessage = buildString {
|
override val errorMessage = buildString {
|
||||||
// cause:
|
// cause:
|
||||||
append("There ").append(
|
append("There ").append(
|
||||||
@@ -58,7 +52,7 @@ class UnexpectedUnboundIrSymbols(unboundSymbols: Set<IrSymbol>, whenDetected: St
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun looksLikeEnumEntries(signature: IdSignature?) : Boolean = when (signature) {
|
fun looksLikeEnumEntries(signature: IdSignature?): Boolean = when (signature) {
|
||||||
is IdSignature.AccessorSignature -> looksLikeEnumEntries(signature.propertySignature)
|
is IdSignature.AccessorSignature -> looksLikeEnumEntries(signature.propertySignature)
|
||||||
is IdSignature.CompositeSignature -> looksLikeEnumEntries(signature.inner)
|
is IdSignature.CompositeSignature -> looksLikeEnumEntries(signature.inner)
|
||||||
is IdSignature.CommonSignature -> signature.shortName == "entries"
|
is IdSignature.CommonSignature -> signature.shortName == "entries"
|
||||||
@@ -72,7 +66,7 @@ class SignatureIdNotFoundInModuleWithDependencies(
|
|||||||
private val problemModuleDeserializer: IrModuleDeserializer,
|
private val problemModuleDeserializer: IrModuleDeserializer,
|
||||||
private val allModuleDeserializers: Collection<IrModuleDeserializer>,
|
private val allModuleDeserializers: Collection<IrModuleDeserializer>,
|
||||||
private val userVisibleIrModulesSupport: UserVisibleIrModulesSupport
|
private val userVisibleIrModulesSupport: UserVisibleIrModulesSupport
|
||||||
) : KotlinIrLinkerIssue(needStacktrace = false) {
|
) : KotlinIrLinkerIssue() {
|
||||||
override val errorMessage = try {
|
override val errorMessage = try {
|
||||||
computeErrorMessage()
|
computeErrorMessage()
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
@@ -129,7 +123,7 @@ class SignatureIdNotFoundInModuleWithDependencies(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NoDeserializerForModule(moduleName: Name, idSignature: IdSignature?) : KotlinIrLinkerIssue(needStacktrace = false) {
|
class NoDeserializerForModule(moduleName: Name, idSignature: IdSignature?) : KotlinIrLinkerIssue() {
|
||||||
override val errorMessage = buildString {
|
override val errorMessage = buildString {
|
||||||
append("Could not load module ${moduleName.asString()}")
|
append("Could not load module ${moduleName.asString()}")
|
||||||
if (idSignature != null) append(" in an attempt to find deserializer for symbol ${idSignature.render()}.")
|
if (idSignature != null) append(" in an attempt to find deserializer for symbol ${idSignature.render()}.")
|
||||||
@@ -140,7 +134,7 @@ class SymbolTypeMismatch(
|
|||||||
private val cause: IrSymbolTypeMismatchException,
|
private val cause: IrSymbolTypeMismatchException,
|
||||||
private val allModuleDeserializers: Collection<IrModuleDeserializer>,
|
private val allModuleDeserializers: Collection<IrModuleDeserializer>,
|
||||||
private val userVisibleIrModulesSupport: UserVisibleIrModulesSupport
|
private val userVisibleIrModulesSupport: UserVisibleIrModulesSupport
|
||||||
) : KotlinIrLinkerIssue(needStacktrace = true) {
|
) : KotlinIrLinkerIssue() {
|
||||||
override val errorMessage = try {
|
override val errorMessage = try {
|
||||||
computeErrorMessage()
|
computeErrorMessage()
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
|
|||||||
Reference in New Issue
Block a user