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

Target java17 #5045

Merged
merged 13 commits into from
Oct 31, 2024
Merged

Target java17 #5045

merged 13 commits into from
Oct 31, 2024

Conversation

pditommaso
Copy link
Member

@pditommaso pditommaso commented Jun 2, 2024

This set Java 17 as target bytecode generation and lang compatibility.

TLDR; so far mock created by Spock used cglib, which is not maintained anymore and does not support Java 17. Bytebuddy should replace it, but some tests fail.

https://spockframework.org/spock/docs/2.0-M4/faq.html

Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Copy link

netlify bot commented Jun 2, 2024

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit e710ac1
🔍 Latest deploy log https://app.netlify.com/sites/nextflow-docs-staging/deploys/67232597f3ca740008f63bae
😎 Deploy Preview https://deploy-preview-5045--nextflow-docs-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@pditommaso
Copy link
Member Author

@bentsherman when you have some chance, it would be nice to fix the failing tests so we can move to Java 17 as target bytecode

@bentsherman
Copy link
Member

So this will drop support for Java 11?

@pditommaso
Copy link
Member Author

Yes, it may be needed to drop support for Java 11 since it's becoming more and more complicated to make coexisting different projects with Java 11 as baseline

@pditommaso
Copy link
Member Author

Not needed in the short term. Closing for now

@bentsherman
Copy link
Member

The factor connecting all of the failing tests is that they are mocking or spying RepositoryProvider or a subclass of it. The GithubRepositoryProviderTest is the only test that mocks a subclass, all of the other provider subclasses do not.

  • Adding a default constructor didn't fix it (I think these are not needed anyway thanks to objenesis).
  • Making RepositoryProvider concrete instead of abstract didn't fix it
  • Moving TagInfo and BranchInfo out of RepositoryProvider didn't fix it (read somewhere that bytebuddy has issues mocking inner classes)

Signed-off-by: Ben Sherman <[email protected]>
@pditommaso pditommaso requested a review from a team as a code owner August 12, 2024 18:16
@pditommaso
Copy link
Member Author

@bentsherman do you have a concrete need for Java 17? I guess there are still people running on Java 11

@bentsherman
Copy link
Member

The main feature I'm using is this pattern matching syntax:

if( node instanceof Expression exp ) {
  // ...
}

Whereas with Java 11 I would have to do:

if( node instanceof Expression ) {
  var exp = (Expression) node;
  // ...
}

I use this a lot in the parsing and AST code, so it does make the code more concise. But I can go back to the old way if lots of people still rely on Java 11. I figured it should be pretty easy to upgrade to Java 17 these days, I don't know how many people would actually be stuck with 11

@pditommaso
Copy link
Member Author

Understand. Are you sure that this requires Java 17 bytecode generation and not Java 17 lang compatibility?

@bentsherman
Copy link
Member

I did try that:

java {
  sourceCompatibility = JavaVersion.VERSION_17
  targetCompatibility = JavaVersion.VERSION_11
}

But I was surprised to find it wasn't allowed:

Execution failed for task ':language-server:compileJava'.
> warning: source release 17 requires target release 17

@bentsherman
Copy link
Member

But maybe there is some other way to do it that I don't know about? I would expect Java to still be able to generate Java 11 bytecode with such a simple change, but maybe there are other deeper changes that make it impossible

@bentsherman
Copy link
Member

Java 11 seems to be in a similar EOL status as Java 8, at least for Oracle Java: https://endoflife.date/oracle-jdk

So I think it would be safe to require Java >=17. Users always have the previous versions of Nextflow

Maybe it would be helpful to look up the compatibility matrices of other Java projects of similar size to see what they're doing

@pditommaso
Copy link
Member Author

I agree this is a nice to have. I'd like just postpone merging this to post 24.10.x to not fragment too much Java requirement for this year stable releases.

@bentsherman
Copy link
Member

Fine by me. I was actually going to suggest waiting until 25.04 . We can merge the new config parser then too. That will give me more time to stabilize some things

@bentsherman
Copy link
Member

  • or an edge release after 24.10

@bentsherman bentsherman linked an issue Sep 25, 2024 that may be closed by this pull request
docs/install.md Outdated Show resolved Hide resolved
Signed-off-by: Paolo Di Tommaso <[email protected]>
@pditommaso
Copy link
Member Author

Moving forward this

@pditommaso pditommaso merged commit 0140f95 into master Oct 31, 2024
5 checks passed
@pditommaso pditommaso deleted the target-java17 branch October 31, 2024 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade Nextflow target Java to version 17
2 participants