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
fix java 8 compatibility #3109
fix java 8 compatibility #3109
Conversation
Does this change our compatibility with older Java versions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Does this change our compatibility with older Java versions?
It will require Puma's JRuby ext to be compiled on Java >= 9 but the resulting gem (when the extension is build) stays compatible with Java 8.
Also according to CI there aren't any targets running with Java 8, which is fine it's just that with the release flag added those wouldn't work (there's a way around with having to switch Java versions while building the ext and running the test suite).
Java 8 should be the minimum version for supported Puma and JRuby versions. According to the Puma 6.x changelog:
https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
if we also want to keep Java 8 compatibility for building the gem (maintainers, java 8 tests, or people who want to build the gem from the source on their own) |
this allows using ``` Rake::JavaExtensionTask.new("name", gemspec) do |ext| ext.release = '8' end ``` on Java 8 (for building the gem), because the flag is available since Java 9, see https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html this flag is for backward compatibility, so it's safe to just skip it if we can't use it. relates to puma/puma#3109 socketry/nio4r#292
I'm fine dropping support for Java 8, but it just makes this a breaking change that needs to wait for Puma 7. |
Just to clarify we do not do that here, the discussion Pavel and I had is mostly about being able to build from source on 8. |
this change doesn't intend to break any existing compatibility. Regular users won't be affected, they still can use Java 8 + Puma. here's a workaround rake-compiler/rake-compiler#213 but this is just for building a gem from the source (maintainers, tests on old environments with Java 8 etc.). I don't think it's a blocker. |
Thanks for the clarification 🙇 |
Description
it's a similar issue as #1772 unfortunately, that PR didn't fix all usage of buffers
since rake-compiler/rake-compiler#200 does support the
--release
flag for compatibility with older java versions, it's cleaner and safer to fix it this way instead of explicitly casting buffer methods as(Buffer) buffer
the downside is, it requires at least Java 9 for building the extension, but I guess it won't be a problem.
closes #3108
Your checklist for this pull request
[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.the only way to test it would be to build the extension with Java 9+, but run tests with Java 8.