jvmMain.compiler.InMemoryMessageCollector.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluid-compiler-jvm Show documentation
Show all versions of fluid-compiler-jvm Show documentation
Compile Kotlin code and run Kapt annotation processing directly from Kotlin
package io.fluidsonic.compiler
import org.jetbrains.kotlin.cli.common.messages.*
internal class InMemoryMessageCollector : MessageCollector {
private var hasErrors = false
private val _messages = mutableListOf()
override fun clear() {
_messages.clear()
}
override fun hasErrors() =
hasErrors
val messages
get() = _messages.toList()
override fun report(severity: CompilerMessageSeverity, message: String, location: CompilerMessageSourceLocation?) {
if (severity.isError)
hasErrors = true
_messages += CompilationMessage(location = location, message = message, severity = severity)
}
}