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

Require Jenkins 2.479.1 or newer #134

Merged

Conversation

MarkEWaite
Copy link
Contributor

@MarkEWaite MarkEWaite commented Jan 19, 2025

Require Jenkins 2.479.1 or newer

Use the most recent plugin BOM 3944.v1a_e4f8b_452db_ and require Jenkins 2.479.1 so that Jakarta EE 9 is used and Java 17 features can be used in the plugin source code.

The developer guide notes that 2.479.1 should be considered if there are specific reasons to want something newer. In this case, we want to reduce the use of the Java EE 8 and Spring Security 5 compatibility layer that was introduced in Jenkins 2.479.1 so that we can eventually remove most of the compatibility layer. We also want to allow use of Java 17 language features.

Java 17 language features used in this pull request include:

  • pattern matching instanceof
  • formatted string (from Java 17 text blocks)

The Java 17 pattern matching instanceof makes it easier to read the code because it defines the new variable as part of the instanceof and performs the cast without requiring a separate statement for the cast.

An Oracle article provides more details on the technique.

Java 17 adds text blocks as part of JEP-378.

Included in that change, strings now have a formatted method that is the same as the String.format() static method. The OpenRewrite migrator for Java 17 suggests replacing String.format() with str.format().

Special thanks to OpenRewrite and Moderne for the Java 17 migration automation.

Supersedes pull request:

Testing done

Confirmed that automated tests pass with Java 21 on Linux. Rely on ci.jenkins.io to confirm that automated tests pass with Java 17 on Windows.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

dependabot bot and others added 4 commits January 13, 2025 19:23
Bumps [org.jenkins-ci.plugins:plugin](https://github.com/jenkinsci/plugin-pom) from 4.88 to 5.5.
- [Release notes](https://github.com/jenkinsci/plugin-pom/releases)
- [Changelog](https://github.com/jenkinsci/plugin-pom/blob/master/CHANGELOG.md)
- [Commits](jenkinsci/plugin-pom@plugin-4.88...plugin-5.5)

---
updated-dependencies:
- dependency-name: org.jenkins-ci.plugins:plugin
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Use the most recent plugin BOM 3944.v1a_e4f8b_452db_

Allows the use of Java 17 features in the plugin source code.
The Java 17 pattern matching instanceof makes it easier to read the
code because it defines the new variable as part of the instanceof and
performs the cast without requiring a separate statement for the cast.

https://docs.oracle.com/en/java/javase/17/language/pattern-matching-instanceof.html
provides more details on the technique.
Java 17 adds text blocks as part of https://openjdk.org/jeps/378

Included in that change, strings now have a formatted method that is
the same as the String.format() static method.  The OpenRewrite
migrator for Java 17 suggests replacing String.format() with
str.format().
@MarkEWaite MarkEWaite requested a review from a team as a code owner January 19, 2025 13:12
@damianszczepanik damianszczepanik merged commit 8a3a729 into jenkinsci:master Jan 19, 2025
18 checks passed
@MarkEWaite MarkEWaite deleted the require-2.479.1-and-java-17 branch January 19, 2025 13:41
@basil
Copy link
Member

basil commented Feb 6, 2025

@damianszczepanik Could this please be released? That would get us one step closer to being able to migrate off the compatibility layer in Jenkins core.

@damianszczepanik
Copy link
Member

@damianszczepanik Could this please be released? That would get us one step closer to being able to migrate off the compatibility layer in Jenkins core.

Plugin has been published

@basil
Copy link
Member

basil commented Feb 11, 2025

Thank you very much!

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.

3 participants