Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump JLine 3.19.0 -> 3.24.1 & sbt 1.9.7 -> 1.9.9 #19744

Merged
merged 4 commits into from
Feb 26, 2024

Conversation

hamzaremmal
Copy link
Member

@hamzaremmal hamzaremmal commented Feb 20, 2024

Fixes #5755, #19704

Tested locally and the difference in behaviour was observed. I'm not sure how to test it with the CI, if anybody has an idea, please let me know. Also, this issue might be a problem sbt/sbt#7177

Tested as follow:

  • Observe that the issue in 3.4.1-RC1
scala-cli repl -S 3.4.1-RC1
Welcome to Scala 3.4.1-RC1 (17.0.7, Java Java HotSpot(TM) 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> class 😃
// defined class 😃

scala> cclas
-- [E006] Not Found Error: -----------------------------------------------------
1 |clas
  |^^^^
  |Not found: clas - did you mean caps?
  |
  | longer explanation available when compiling with `-explain`
1 error found

scala>
  • Publish dotty locally with the correct jline version
  • Observe that the issue is fixed
scala-cli repl -S 3.4.2-RC1-bin-SNAPSHOT
Welcome to Scala 3.4.2-RC1-bin-SNAPSHOT-git-174d4c6 (17.0.7, Java Java HotSpot(TM) 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> class 😃
// defined class 😃

scala> clas
-- [E006] Not Found Error: -----------------------------------------------------
1 |clas
  |^^^^
  |Not found: clas - did you mean caps?
  |
  | longer explanation available when compiling with `-explain`
1 error found

scala>
``

@hamzaremmal hamzaremmal marked this pull request as ready for review February 20, 2024 16:08
@SethTisue
Copy link
Member

SethTisue commented Feb 21, 2024

Also, this issue might be a problem sbt/sbt#7177

Indeed, this PR breaks the repl command in the Dotty build:

sbt:scala3> repl
...
Welcome to Scala 3.4.2-RC1-bin-SNAPSHOT-nonbootstrapped-git-174d4c6 (17.0.10, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

[error] java.lang.NoSuchMethodError: 'org.jline.utils.AttributedString org.jline.utils.AttributedString.fromAnsi(java.lang.String, java.util.List, java.lang.String, java.lang.String)'
[error] 	at org.jline.reader.impl.LineReaderImpl.fromAnsi(LineReaderImpl.java:4232)

But the problem goes away if I update project/build.properties to use sbt 1.10.0-M1, since as Eugene observed at sbt/sbt#7498 (comment) , sbt 1.9.x is on JLine 3.19, whereas the 1.10 series has upgraded to 3.24.1.

Moving Dotty to 1.10.0-M1 seems a bit risky, as it's just a milestone. Maybe we should wait for 1.10.0-RC1 or 1.10.0 final?

In the meantime, I can submit a PR bumping sbt's 1.10.x branch from 3.24.1 to 3.25.1, in the hopes of getting in alignment. (I also plan to upgrade to 3.25.1 in Scala 2.13.14.)

@SethTisue
Copy link
Member

also fixes #19704

@hamzaremmal hamzaremmal linked an issue Feb 21, 2024 that may be closed by this pull request
@SethTisue
Copy link
Member

SethTisue commented Feb 24, 2024

whereas the 1.10 series has upgraded to 3.24.1

Breaking news! Eugene has now released sbt 1.9.9 which also upgrades to 3.24.1. So if you add a commit that changes 1.9.7 to 1.9.9 to everywhere, that should fix the repl command and make this PR mergeable.

(At least unless the CI failure is real? It isn't obvious to me whether it is.)

@hamzaremmal
Copy link
Member Author

Oh great. I'll bump sbt to 1.9.9 too

@hamzaremmal hamzaremmal changed the title Bump JLine to 3.19.0 -> 3.25.1 Bump JLine 3.19.0 -> 3.24.1 & sbt 1.9.7 -> 1.9.9 Feb 24, 2024
@hamzaremmal
Copy link
Member Author

Similar test (as described in the above comments) performed in repl with sbt 1.9.9 and scala-cli. It is working fine.

@@ -76,7 +76,7 @@ class CoursierScalaTests:

def emptyArgsEqualsRepl() =
val output = CoursierScalaTests.csScalaCmd()
assertTrue(output.mkString("\n").contains("Unable to create a system terminal")) // Scala attempted to create REPL so we can assume it is working
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stack trace with JLine 3.19.0:

Exception in thread "main" java.lang.IllegalStateException: Unable to create a system terminal
	at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:323)
	at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:265)
	at dotty.tools.repl.JLineTerminal.<init>(JLineTerminal.scala:25)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:144)
	at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:135)
	at dotty.tools.repl.Main$.main(Main.scala:7)
	at dotty.tools.MainGenericRunner$.run$1(MainGenericRunner.scala:193)
	at dotty.tools.MainGenericRunner$.process(MainGenericRunner.scala:270)
	at dotty.tools.MainGenericRunner$.main(MainGenericRunner.scala:281)
	at dotty.tools.MainGenericRunner.main(MainGenericRunner.scala)

@@ -76,7 +76,7 @@ class CoursierScalaTests:

def emptyArgsEqualsRepl() =
val output = CoursierScalaTests.csScalaCmd()
assertTrue(output.mkString("\n").contains("Unable to create a system terminal")) // Scala attempted to create REPL so we can assume it is working
assertTrue(output.mkString("\n").contains("Unable to create a terminal")) // Scala attempted to create REPL so we can assume it is working
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stack trace with JLine 3.24.1:

Exception in thread "main" java.lang.IllegalStateException: Unable to create a terminal
	at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:394)
	at org.jline.terminal.TerminalBuilder.build(TerminalBuilder.java:362)
	at dotty.tools.repl.JLineTerminal.<init>(JLineTerminal.scala:25)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:144)
	at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:135)
	at dotty.tools.repl.Main$.main(Main.scala:7)
	at dotty.tools.MainGenericRunner$.run$1(MainGenericRunner.scala:193)
	at dotty.tools.MainGenericRunner$.process(MainGenericRunner.scala:270)
	at dotty.tools.MainGenericRunner$.main(MainGenericRunner.scala:281)
	at dotty.tools.MainGenericRunner.main(MainGenericRunner.scala)
	Suppressed: java.io.IOException: Unable to find terminal provider ffm
		at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74)
		at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:665)
		at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:630)
		at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395)
		... 9 more
	Suppressed: java.io.IOException: Unable to find terminal provider jni
		at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74)
		at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:665)
		at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:632)
		at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395)
		... 9 more
	Suppressed: java.io.IOException: Unable to find terminal provider jansi
		at org.jline.terminal.spi.TerminalProvider.load(TerminalProvider.java:74)
		at org.jline.terminal.TerminalBuilder.checkProvider(TerminalBuilder.java:665)
		at org.jline.terminal.TerminalBuilder.getProviders(TerminalBuilder.java:634)
		at org.jline.terminal.TerminalBuilder.doBuild(TerminalBuilder.java:395)
		... 9 more

@SethTisue
Copy link
Member

SethTisue commented Feb 25, 2024

@hamzaremmal we may want to go straight to 3.25.1, because of scala/bug#12957 — it's harmless, but annoying (and people won't be sure it's harmless unless they google for it)

we intend to upgrade to 3.25.1 in Scala 2.13.14 (2.13.13 is on 3.24.1), and presumably sbt will take the upgrade too before too much longer

a 3.24 vs 3.25 mismatch between Scala and sbt is probably okay, but we'll need to test it to be sure

@hamzaremmal
Copy link
Member Author

I will bump it to 3.25.1 as soon as #19772 is resolved (to avoid running the CI multiple times)

@hamzaremmal hamzaremmal merged commit a015a15 into scala:main Feb 26, 2024
19 checks passed
@hamzaremmal hamzaremmal deleted the i5755 branch February 26, 2024 16:52
@SethTisue SethTisue added the backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. label Feb 26, 2024
@hamzaremmal hamzaremmal added the release-notes Should be mentioned in the release notes label Feb 26, 2024
@hamzaremmal
Copy link
Member Author

hamzaremmal commented Feb 26, 2024

Additional information for the release note #19704 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. release-notes Should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JLine version is outdated Error while handling unicode characters in REPL
4 participants