Skip to content

Commit 1e957ee

Browse files
authored
bugfix: Fix issue with JDK 8 compatibility in mtagsShared (#24071)
This got introduced, because we no longer check in Scala Next. I added an additional check in metals to make sure this doesn't happen anymore.
2 parents 1c6ee2f + ab5a007 commit 1e957ee

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

project/Build.scala

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,17 @@ object Build {
597597
recur(lines, false)
598598
}
599599

600+
// Hotfix for JDK 8
601+
def replaceJDK11APIs(lines: List[String], file: File): List[String] = {
602+
if (file.getName == "InlayHints.scala") {
603+
lines.map{
604+
_.replace(".repeat(naiveIndent)", " * naiveIndent")
605+
}
606+
} else {
607+
lines
608+
}
609+
}
610+
600611
/** replace imports of `com.google.protobuf.*` with compiler implemented version */
601612
def replaceProtobuf(lines: List[String]): List[String] = {
602613
def recur(ls: List[String]): List[String] = ls match {
@@ -1271,7 +1282,7 @@ object Build {
12711282
val mtagsSharedSources = (targetDir ** "*.scala").get.toSet
12721283
mtagsSharedSources.foreach(f => {
12731284
val lines = IO.readLines(f)
1274-
val substitutions = (replaceProtobuf(_)) andThen (insertUnsafeNullsImport(_))
1285+
val substitutions = (replaceProtobuf(_)) andThen (insertUnsafeNullsImport(_)) andThen (replaceJDK11APIs(_, f))
12751286
IO.writeLines(f, substitutions(lines))
12761287
})
12771288
mtagsSharedSources

0 commit comments

Comments
 (0)