Skip to content

Conversation

@MarkEWaite
Copy link
Contributor

Use Java 17 language features

Use Java 17 pattern matching instanceof. Makes the code easier to read by avoding the cast that often follows an instanceof.

Use Java 17 string formatting. Slight simplification of the code through OpenRewrite.

Use Java 17 @serial annotation. Annotation that may allow future checks for serialization. No real benefit today as far as I can tell.

Special thanks to OpenRewrite for https://docs.openrewrite.org/recipes/java/migrate/upgradetojava17

Testing done

Confirmed that automated tests pass.

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

Makes the code easier to read by avoding the cast that often follows
an instanceof.
Annotation that may allow future checks for serialization.  No real
benefit today as far as I can tell.
Slight simplification of the code through OpenRewrite
@MarkEWaite MarkEWaite requested a review from a team as a code owner March 1, 2025 23:56
@krisstern
Copy link
Member

Thanks @MarkEWaite for the PR!

@krisstern krisstern merged commit 5018cec into jenkinsci:master Mar 2, 2025
17 checks passed
@MarkEWaite MarkEWaite deleted the use-java-17-language-features branch March 2, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants