Comments (12)
gah, this is bad. attn @eed3si9n @lrytz
over in scala/scala we merged the JLine 3.24.1 upgrade all the way back in October 2023, but of course it's common for nobody to notice a regression in nightlies, even over a period of months. and obviously the community build is no help with interactive stuff like this
Eugene, let's discuss, is this remediable in the sbt 1.9.x series, or do we have to try to get to 1.10.0 soon, or what?
from sbt.
It works on my machine with sbt 1.10.0-M1:
sbt:foo> console
[info] Starting scala interpreter...
Welcome to Scala 2.13.13 (OpenJDK 64-Bit Server VM, Java 1.8.0_362).
Type in expressions for evaluation. Or try :help.
scala> 1 + 1
val res0: Int = 2
from sbt.
Oh btw, thanks @xuwei-k for reporting this! 🙏🏼
from sbt.
It works on my machine with sbt 1.10.0-M1
Whew. Any chance of accelerating the progression to 1.10.0-RC1 and 1.10.0 final? Is that progression waiting on anything in particular?
from sbt.
Or I guess we can just backport the JLine bump to 1.9.x series. At this point, the odds of it potentially breaking more things can be balanced with the fact that latest stable Scala 2.13.x can't console on sbt 1.9.x.
from sbt.
Here's my PR - #7503
from sbt.
Or I guess we can just backport the JLine bump to 1.9.x series
Suits me!!
from sbt.
community build is no help with interactive stuff like this
yeah, but it's still on us (scala/scala), we should have the most basic smoke test somewhere.
from sbt.
good news is you can pipe a command from stdin:
$ echo "sys.exit()" | sbt console
[info] welcome to sbt 1.9.8 (Azul Systems, Inc. Java 1.8.0_352)
....
[info] Starting scala interpreter...
Welcome to Scala 2.13.13 (OpenJDK 64-Bit Server VM, Java 1.8.0_352).
Type in expressions for evaluation. Or try :help.
Failed to initialize compiler: NoSuchMethodError.
This is most often remedied by a full clean and recompile.
Otherwise, your classpath may continue bytecode compiled by
different and incompatible versions of scala.
java.lang.NoSuchMethodError: org.jline.utils.AttributedString.fromAnsi(Ljava/lang/String;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;)Lorg/jline/utils/AttributedString;
at org.jline.reader.impl.LineReaderImpl.fromAnsi(LineReaderImpl.java:4232)
at org.jline.reader.impl.LineReaderImpl.expandPromptPattern(LineReaderImpl.java:4154)
at org.jline.reader.impl.LineReaderImpl.setPrompt(LineReaderImpl.java:1253)
at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:628)
at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:512)
at scala.tools.nsc.interpreter.jline.Reader.readOneLine(Reader.scala:44)
at scala.tools.nsc.interpreter.shell.InteractiveReader.readLine(InteractiveReader.scala:38)
at scala.tools.nsc.interpreter.shell.InteractiveReader.readLine$(InteractiveReader.scala:38)
at scala.tools.nsc.interpreter.jline.Reader.readLine(Reader.scala:34)
at scala.tools.nsc.interpreter.shell.ILoop.readOneLine(ILoop.scala:455)
at scala.tools.nsc.interpreter.shell.ILoop.loop(ILoop.scala:460)
at scala.tools.nsc.interpreter.shell.ILoop.run(ILoop.scala:993)
at scala.tools.xsbt.ConsoleBridge.run(ConsoleBridge.scala:81)
at sbt.internal.inc.AnalyzingCompiler.console(AnalyzingCompiler.scala:208)
at sbt.Console.console0$1(Console.scala:65)
at sbt.Console.$anonfun$apply$5(Console.scala:75)
at sbt.Run$.executeSuccess(Run.scala:187)
at sbt.Console.$anonfun$apply$4(Console.scala:75)
at sbt.internal.util.Terminal.withRawInput(Terminal.scala:146)
at sbt.internal.util.Terminal.withRawInput$(Terminal.scala:144)
at sbt.internal.util.Terminal$ProxyTerminal$.withRawInput(Terminal.scala:424)
at sbt.Console.$anonfun$apply$3(Console.scala:75)
at sbt.internal.util.Terminal$DefaultTerminal.withRawOutput(Terminal.scala:1074)
at sbt.internal.util.Terminal$ProxyTerminal$.withRawOutput(Terminal.scala:463)
at sbt.Console.apply(Console.scala:72)
at sbt.Console.apply(Console.scala:50)
at sbt.Console.apply(Console.scala:42)
at sbt.Defaults$.$anonfun$consoleTask$1(Defaults.scala:2237)
at sbt.Defaults$.$anonfun$consoleTask$1$adapted(Defaults.scala:2223)
at scala.Function1.$anonfun$compose$1(Function1.scala:49)
at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
at sbt.std.Transform$$anon$4.work(Transform.scala:69)
at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
at sbt.Execute.work(Execute.scala:292)
at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
[success] Total time: 7 s, completed Feb 23, 2024 2:32:40 AM
bad news is that console
task considers this to be a success and exits with 0:
$ echo $?
0
from sbt.
bad news is that
console
task considers this to be a success and exits with 0:
same result with sbt 1.5.7 😢
from sbt.
@eed3si9n do you know how the mechanics are working here? Why isn't the newer jline version being used as the runtime classpath? This can't be the scala version "mediator". It could just be selectively picking the scala jars to pull in, ignoring the other transitive dependencies metadata, like jline version. Or could it be some classloader or classloading layering issue. Do you know?
from sbt.
Yea. We exclude JLine from the layered classloader unless useScalaReplJLine
setting is true:
sbt/main/src/main/scala/sbt/Defaults.scala
Lines 669 to 672 in 48c2376
This is because JLine and JAnsi basically loads native libraries, and unlike other JVM libraries we haven't have multiple versions in one process space. My mental model of sbtn is like what I imagine the way telnet works, in a sense that the client program captures all keyboard inputs like VK_A
or VK_UP
etc, and there's a corresponding virtualized terminal emulator that sends the virtual key input VK_UP
, and relays back that up-arrow does. Up-arrow is last history in both sbt shell and Scala REPL, for example so we run JLine terminal that's tracking the history etc. See 90dacc3.
There's further complication that happened for Scala 3, I think because they use compiler-interface, so #6199 changed the layered Classloader further, but the idea is the same.
Maybe a better solution would be to let sbtn fork its own java
process.
from sbt.
Related Issues (20)
- Sbt build times substantially slower on Windows vs Ubuntu. HOT 1
- `sbt.PluginData#dependencyClasspath` contains multiple `scala-library/compiler/reflect/xml` jars HOT 6
- How to report slowness issues from built-in resolver repo.typesafe.com (scala.jfrog.io)? HOT 16
- NPE when compiling HOT 1
- Fail to boot with match error with `scala-tools-releases` in `repositories` HOT 3
- Project not found when running with ++scalaVersion HOT 1
- Unable to run tests with javaOptions HOT 2
- Scala program does not receive EOF when using `sbt run`
- scalacOptions do not follow the delegation rules HOT 6
- SBT console "swallow" keypresses on JDK 22 and Windows 10
- sbt doesn't seem to follow 307 redirects HOT 1
- sbt whatDependsOn does not work anymore HOT 2
- set window title to organization + artifactId + sbt command HOT 1
- Incorrect spacing in build.properties causes sbt bash script to incorrectly choose to use native client
- files that depend on a dynamic class (say C) are not recompiled when C's private fields become public HOT 3
- Not able to start more than one service at a time using different ports. error is SBT server is already booting.
- Unable to track objects with Maps HOT 3
- StackOverflowError when using dependencyBrowseTree HOT 3
- Do not set -Xsource:3 flag automatically HOT 3
- `META-INF/MANIFEST.MF` has no parent zip entry `META-INF/` when packaging to a jar. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sbt.