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)
- Remove repo.scala-sbt.org and repo.typesafe.com from boot resolver HOT 4
- Add documentation for sbt dependencyTree plugin HOT 3
- scaladoc warning: Flag -project set repeatedly HOT 3
- inputFileChanges cannot be scoped to a task scoped to another task HOT 1
- sbt evicted should account for maven dependency version ranges HOT 3
- SBT native `new` command crashes with any template HOT 1
- JLine version (3.19.0) is outdated HOT 5
- `illegal reflective access operation` using sbt 1.9.9 with Java 11 (but not 8 or 17 or 21) HOT 2
- When there is a corrupted jar in Maven's local repo, it will fail HOT 2
- `sbt new` fails to parse arguments correctly on Windows HOT 3
- sbt throws a `StackOverflowError` when reporting a self-referencing exception. HOT 2
- improvement: [BSP] Add `jvmBuildTarget` info to `workspace/buildTargets` response
- Packages including "scala-library" in its name cannot be imported by other projects. HOT 1
- `getClass.getResource` yields wrong result using 1.9.9 with `sbtPlugin := true` HOT 3
- Found [error] [launcher] error during sbt launcher: java.nio.file.AccessDeniedException: /run/user/0/.sbt on AMI 2023 HOT 2
- sbt launcher - error retrieving required libraries for SBT 0.x HOT 17
- scaladoc: does not include all inline concrete methods HOT 1
- Sbt compile cannot include the dependency jar to classpath HOT 7
- sbt in `--client` mode loses stdout/stderr of the forked processes in continuous (watch) task mode after the task ir reevaluated
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.