sbt / sbt

sbt, the interactive build tool
https://scala-sbt.org
Apache License 2.0
4.79k stars 933 forks source link

`illegal reflective access operation` using sbt 1.9.9 with Java 11 (but not 8 or 17 or 21) #7505

Open mkurz opened 6 months ago

mkurz commented 6 months ago
$ java -version
openjdk version "11.0.22" 2024-01-16
OpenJDK Runtime Environment Temurin-11.0.22+7 (build 11.0.22+7)
OpenJDK 64-Bit Server VM Temurin-11.0.22+7 (build 11.0.22+7, mixed mode)

$ cat project/build.properties 
sbt.version=1.9.9

$ sbt
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jline.terminal.impl.exec.ExecTerminalProvider$ReflectionRedirectPipeCreator (file:/home/mkurz/.sbt/boot/scala-2.12.18/org.scala-sbt/sbt/1.9.9/jline-terminal-3.24.1.jar) to constructor java.lang.ProcessBuilder$RedirectPipeImpl()
WARNING: Please consider reporting this to the maintainers of org.jline.terminal.impl.exec.ExecTerminalProvider$ReflectionRedirectPipeCreator
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[info] welcome to sbt 1.9.9 (Eclipse Adoptium Java 11.0.22)
...
SethTisue commented 6 months ago

This is the same as https://github.com/scala/bug/issues/12957 and further upgrading JLine to 3.25.1 (1.9.9 went to 3.24.1) should fix it.

The warning is harmless/ignorable.

irisTa56 commented 5 months ago

I could suppress the warnings by setting a system property mentioned in https://github.com/jline/jline3/issues/951. (I'm using macOS 14.4.1)

$ sbt -Dorg.jline.terminal.exec.redirectPipeCreationMode=native
[info] welcome to sbt 1.9.9 (Amazon.com Inc. Java 11.0.22)
...

Still, I would appreciate it if the warning could be resolved without setting the system property.

dabrowski-adam commented 1 month ago

I could suppress the warnings by setting a system property mentioned in jline/jline3#951. (I'm using macOS 14.4.1)

$ sbt -Dorg.jline.terminal.exec.redirectPipeCreationMode=native
[info] welcome to sbt 1.9.9 (Amazon.com Inc. Java 11.0.22)
...

Still, I would appreciate it if the warning could be resolved without setting the system property.

As a temporary workaround, that setting can be placed in .sbtopts.

https://www.scala-sbt.org/1.x/docs/Command-Line-Reference.html#sbt+JVM+options+and+system+properties