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

System.exit behaviour will not be supported from JDK 18+ #37

Open
ashleyfrieze opened this issue Jan 10, 2022 · 9 comments
Open

System.exit behaviour will not be supported from JDK 18+ #37

ashleyfrieze opened this issue Jan 10, 2022 · 9 comments

Comments

@ashleyfrieze
Copy link
Member

The Security Manager will be removed in later Java and this will stop the SystemExit mocking from working.

@zordym
Copy link

zordym commented Apr 7, 2023

Hello, is there any plan to fix this ?

@ashleyfrieze
Copy link
Member Author

If you would like to create a PR then please do. I'll look at it in the mid to long term otherwise.

@ashleyfrieze
Copy link
Member Author

I think the best thing to do is look at a System Stubs v3 for JDK 18+. One that's built on JDK 17 - perhaps keeping the JDK8 branch alive just in case.

@zordym
Copy link

zordym commented Apr 10, 2023

Indeed is one of my idea was moving to jdk 17 as most of framework have move on this version

I have fork the project to perform the changes

@ashleyfrieze
Copy link
Member Author

ashleyfrieze commented Apr 10, 2023

Sounds good @zordym. If you can put up a PR with your best attempt, even if it doesn't work 100%, I don't mind joining in with you on it to try to get it over the line.

Keep me posted on this issue.

@zordym
Copy link

zordym commented Apr 10, 2023

For sure, I will do my best

@ashleyfrieze
Copy link
Member Author

@zordym - let's also make sure to update https://github.com/webcompere/system-stubs/blob/main/History.md to include your contribution as well as having you on the usual GH statistics. We do open source because we care about having the tool and sharing that. We deserve the credit.

@vitalijr2
Copy link

vitalijr2 commented Feb 23, 2024

As far as I understand it's expected behavior, don't I?

WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by uk.org.webcompere.systemstubs.security.SecurityManagerStub (file:/home/username/.m2/repository/uk/org/webcompere/system-stubs-core/2.1.6/system-stubs-core-2.1.6.jar)
WARNING: Please consider reporting this to the maintainers of uk.org.webcompere.systemstubs.security.SecurityManagerStub
WARNING: System::setSecurityManager will be removed in a future release

My env:

  • java -version
    openjdk version "17.0.10" 2024-01-16
    OpenJDK Runtime Environment (build 17.0.10+7)
    OpenJDK 64-Bit Server VM (build 17.0.10+7, mixed mode)
  • ./mvnw -version
    Apache Maven 3.9.6
  • jUnit 5.10.2

@ashleyfrieze
Copy link
Member Author

@vitalijr2 - yes. You're stubbing System.exit in a later version of Java using System Stubs?

If enough people need a solution to this, we may have to look at a new way of intercepting it from Java 18 onwards.

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

No branches or pull requests

3 participants