Skip to content

Commit

Permalink
Remove Deprecated Usage Of String#lines Method
Browse files Browse the repository at this point in the history
In JDK11 a method on `String` was added named `lines` which returned a `java.util.stream.Stream`. This collided with the enrichment method from Scala's `StringOps` class by the same name which returned an `Iterator`. The result, for metals, is that it was not possible to build metals using JDK11 or greater.

This commit uses the new enrichment method `linesIterator` which was added to the Scala standard library as a replacement. This now enables metals to compile on JDK11.

See: scala/bug#11125
  • Loading branch information
isomarcte committed Dec 4, 2019
1 parent 9a48d62 commit 4d78f9c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ class MetalsLanguageServer(
case ServerCommands.GotoLog() =>
Future {
val log = workspace.resolve(Directories.log)
val linesCount = log.readText.lines.size
val linesCount = log.readText.linesIterator.size
val pos = new l.Position(linesCount, 0)
languageClient.metalsExecuteClientCommand(
new ExecuteCommandParams(
Expand Down

0 comments on commit 4d78f9c

Please sign in to comment.