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

Java 8 compatibility #28

Open
ebourg opened this issue Dec 6, 2024 · 3 comments
Open

Java 8 compatibility #28

ebourg opened this issue Dec 6, 2024 · 3 comments

Comments

@ebourg
Copy link

ebourg commented Dec 6, 2024

Hi,

The version 2.0.2 was built with Java 17 but it looks like the projects builds and tests fine on Java 8. JUnit 5 also has Java 8 as baseline. Would it be possible to build the next release with Java 8 please?

Thank you

@tginsberg
Copy link
Owner

It might run fine on Java 8, but I'd really like to keep the baseline moving forward.

If you're on Java 8, version 1.1.2 is actually superior to 2.0.2 (in my opinion) because it handles more cases than 2.x currently does. 1.1.2 still uses the Java SecurityManager, which should stop all attempts to exit, whereas the 2.x version currently covers a limited number of use cases and requires a more complex setup.

@ebourg
Copy link
Author

ebourg commented Dec 6, 2024

Actually my project (https://github.com/ebourg/jsign) supports Java 8 to 21 and uses a custom SecurityManager to test the value returned by System.exit(). The build fails on Java 24 and I hoped I could replace the SecurityManager with junit5-system-exit. But that's not possible since it breaks the build on Java 8.

Is the API of the versions 1.1.2 and 2.0.2 compatible? If so I could use the version 1.x for Java 8/11, and the version 2.x for Java 17 and later.

@tginsberg
Copy link
Owner

Hey @ebourg - Sorry for the delay, I've been focused on work and Advent of Code and haven't had time to focus on system exit. I totally get your point - you have a library that supports 8 through 21 and (rightly) want to test it. I think 8 through 21 using version 1.x is not really an issue (you just have to tell Java you want the SecurityManager to be enabled starting with Java 17). See here for details on what/why..

I think the problem creeps in with Java 24 because JEP 486 permanently disables it. So that means using version 2.x, which as you point out means Java 17+ and if you have a library that otherwise works for 8 through to 24 means this library won't help. So really good point and I understand the need.

Let me consider it and see about shipping 2.1 and possibly moving back to Java 8. I hope to do this towards the end of the month while I'm on break.

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

2 participants