Skip to content

Commit 4378b39

Browse files
committed
Handle 'ExplicitBackingFields' compiler warnings
1 parent 201bc6b commit 4378b39

File tree

1 file changed

+13
-5
lines changed
  • src/main/kotlin/com/compiler/server/compiler/components

1 file changed

+13
-5
lines changed

src/main/kotlin/com/compiler/server/compiler/components/CliUtils.kt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,25 @@ fun <T> CLICompiler<*>.tryCompilation(inputDirectory: Path, inputFiles: List<Pat
6464
message: String,
6565
location: CompilerMessageSourceLocation?
6666
): String {
67-
val textInterval = location?.let {
68-
TextInterval(
69-
start = TextInterval.TextPosition(minusOne(location.line), minusOne(location.column)),
70-
end = TextInterval.TextPosition(minusOne(location.lineEnd), minusOne(location.columnEnd))
71-
)
67+
when {
68+
// suppress -XXLanguage:+ExplicitBackingFields
69+
severity == STRONG_WARNING && message.contains("ExplicitBackingFields") ->
70+
return ""
7271
}
72+
7373
val messageSeverity: ProjectSeveriry = when (severity) {
7474
EXCEPTION, ERROR -> ProjectSeveriry.ERROR
7575
STRONG_WARNING, WARNING -> ProjectSeveriry.WARNING
7676
INFO, LOGGING, OUTPUT -> return ""
7777
}
78+
79+
val textInterval = location?.let {
80+
TextInterval(
81+
start = TextInterval.TextPosition(minusOne(location.line), minusOne(location.column)),
82+
end = TextInterval.TextPosition(minusOne(location.lineEnd), minusOne(location.columnEnd))
83+
)
84+
}
85+
7886
val errorFilePath = location?.path?.let(::Path)?.outputFilePathString() ?: defaultFileName
7987

8088
val className = if (!message.startsWith(UNRESOLVED_REFERENCE_PREFIX) && severity == ERROR) "red_wavy_line" else messageSeverity.name

0 commit comments

Comments
 (0)