Skip to content

Fix REPL on JDK 24+ for Scala versions with split JLine modules - #4436

Open
lrytz wants to merge 1 commit into
VirtusLab:mainfrom
lrytz:fix/repl-jline-module-name-scala2
Open

Fix REPL on JDK 24+ for Scala versions with split JLine modules#4436
lrytz wants to merge 1 commit into
VirtusLab:mainfrom
lrytz:fix/repl-jline-module-name-scala2

Conversation

@lrytz

@lrytz lrytz commented Aug 20, 2026

Copy link
Copy Markdown

The Scala 2 branch passed --add-modules org.jline, which is the automatic
module name of the org.jline:jline uber-jar. Scala 2.13.19 switches to the
individual JLine modules (as Scala 3 already did), where no org.jline module
exists, so the REPL dies with:

java.lang.module.FindException: Module org.jline not found

scala/scala#11275

Use --add-modules ALL-MODULE-PATH instead of naming a module. The module path
assembled here only ever holds JLine artifacts, so this works for both shapes
and needs no per-Scala-version logic; the Scala 2 and Scala 3 branches collapse
into one. --enable-native-access still needs a real module name, picked from
whether the split-out jline-native artifact is present.

Extracted as jlineJavaOpts so it can be unit tested.

`--add-modules org.jline` names the `org.jline:jline` uber-jar's module. Scala
2.13.19 switches to the individual JLine modules, where it doesn't exist:

  java.lang.module.FindException: Module org.jline not found

`ALL-MODULE-PATH` (https://openjdk.org/jeps/261) works for both shapes and
merges the Scala 2 and Scala 3 branches. `--enable-native-access` has no
equivalent, so it still needs a module name.
@SethTisue

Copy link
Copy Markdown
Contributor

Does it work with 2.12 too?

@Gedochao

Copy link
Copy Markdown
Contributor

Does it work with 2.12 too?

Let's run integration tests on this. They're currently gated to run on Scala 2.13+

javaVersion: Int
): Seq[String] =
if javaVersion >= 24 && jlineArtifacts.nonEmpty then {
val hasSplitModules =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
val hasSplitModules =
val hasJLineNative =

NIT more readable, IMO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants