[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:
Dmitriy Dolovov
2023-11-29 22:07:14 +01:00
committed by Space Team
parent 50dd94502b
commit e92017f64e
11 changed files with 60 additions and 16 deletions
@@ -25,6 +25,7 @@ private class CompilerLoggerAdapter(
override fun warning(message: String) = messageCollector.report(if (treatWarningsAsErrors) ERROR else STRONG_WARNING, message, null)
override fun error(message: String) = messageCollector.report(ERROR, message, null)
@Deprecated(Logger.FATAL_DEPRECATION_MESSAGE, ReplaceWith(Logger.FATAL_REPLACEMENT))
override fun fatal(message: String): Nothing {
error(message)
(messageCollector as? GroupingMessageCollector)?.flush()