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

Drop TrapExit #6665

Merged
merged 1 commit into from Sep 19, 2021
Merged

Drop TrapExit #6665

merged 1 commit into from Sep 19, 2021

Conversation

eed3si9n
Copy link
Member

Fixes #6558

Problem

sbt uses SecurityManager feature of JDK to trap sys.exit call during
run-like tasks, since we emulate run and console as function calls.
JDK 17 deprecated SecurityManager and it's printing warnings.

Solution

About 10 years go, exit was a convenient way of quitting both Scala
REPL and sbt shell. Scala 2.11 broke this by removing the Predef.exit.
We still need to worry about run potentially calling sys.exit
but that can be handled using fork feature.
In the long-run, it probably is better to be JDK 17 compatible.

@eed3si9n eed3si9n requested a review from adpi2 September 19, 2021 05:22
@eed3si9n eed3si9n force-pushed the wip/drop_trapexit branch 2 times, most recently from 79812ba to cd0d94e Compare September 19, 2021 09:55
Fixes sbt#6558

Problem
-------
sbt uses SecurityManager feature of JDK to trap `sys.exit` call during
`run`-like tasks, since we emulate `run` and `console` as function calls.
JDK 17 deprecated SecurityManager and it's printing warnings.

Solution
--------
About 10 years go, `exit` was a convenient way of quitting both Scala
REPL and sbt shell. Scala 2.11 broke this by removing the `Predef.exit`.
We still need to worry about `run` potentially calling `sys.exit`
but that can be handled using fork feature.
In the long-run, it probably is better to be JDK 17 compatible.
@xuwei-k
Copy link
Member

xuwei-k commented Nov 28, 2021

private final class TrapExitSecurityException(val exitCode: Int) extends SecurityException {

Should we deprecate or remove TrapExitSecurityException as well? 👀

@eed3si9n
Copy link
Member Author

Should we deprecate or remove TrapExitSecurityException as well?

I think that makes sense.

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.

sbt uses setSecurityManager which is now deprecated on JDK 17
2 participants