[KLIB Resolver] Deprecate Logger.fatal()
Invocation of Logger.fatal() may cause severe side effects such as throwing an exception or even terminating the current JVM process (check various implementations of this function for details). The code that uses Logger.fatal() sometimes expects a particular kind of side effect. This is totally a design flaw. And it's definitely not a responsibility of Logger to influence the execution flow of the program.
This commit is contained in:
committed by
Space Team
parent
50dd94502b
commit
e92017f64e
+3
-1
@@ -34,6 +34,7 @@ import java.nio.file.Path
|
||||
import kotlin.io.path.absolutePathString
|
||||
import kotlin.io.path.extension
|
||||
import kotlin.io.path.isDirectory
|
||||
import org.jetbrains.kotlin.util.Logger as KLogger
|
||||
|
||||
class LLFirStandaloneLibrarySymbolProviderFactory(private val project: Project) : LLFirLibrarySymbolProviderFactory() {
|
||||
override fun createJvmLibrarySymbolProvider(
|
||||
@@ -154,7 +155,7 @@ class LLFirStandaloneLibrarySymbolProviderFactory(private val project: Project)
|
||||
private val LOG = Logger.getInstance(LLFirStandaloneLibrarySymbolProviderFactory::class.java)
|
||||
}
|
||||
|
||||
private object IntellijLogBasedLogger : org.jetbrains.kotlin.util.Logger {
|
||||
private object IntellijLogBasedLogger : KLogger {
|
||||
override fun log(message: String) {
|
||||
LOG.info(message)
|
||||
}
|
||||
@@ -167,6 +168,7 @@ class LLFirStandaloneLibrarySymbolProviderFactory(private val project: Project)
|
||||
LOG.warn(message)
|
||||
}
|
||||
|
||||
@Deprecated(KLogger.FATAL_DEPRECATION_MESSAGE, ReplaceWith(KLogger.FATAL_REPLACEMENT))
|
||||
override fun fatal(message: String): Nothing {
|
||||
throw IllegalStateException(message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user