Refactor: Migrate matcher implementations to Java records Fixes #1002#1009
Open
shubh586 wants to merge 2 commits intojenkinsci:masterfrom
Open
Refactor: Migrate matcher implementations to Java records Fixes #1002#1009shubh586 wants to merge 2 commits intojenkinsci:masterfrom
shubh586 wants to merge 2 commits intojenkinsci:masterfrom
Conversation
- Converted 8 matcher classes to records (AllOfMatcher, AnyOfMatcher, ConstantMatcher, IdMatcher, InstanceOfMatcher, NotMatcher, ScopeMatcher, UsernameMatcher) - Removed manual equals(), hashCode(), toString() implementations (auto-generated by records) - Removed serialVersionUID fields (not needed for records) - Updated CredentialsMatcher.java documentation to emphasize records as best practice - Maintained binary compatibility with existing code - Reduced boilerplate code by ~40% per matcher - Added personal reference files to .gitignore This change aligns with modern Java best practices while preserving backward compatibility for existing Jenkins plugins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR modernizes the credentials plugin matcher implementations by converting them from traditional classes to Java records (Java 14+).
Changes:
This change aligns with modern Java best practices while preserving backward compatibility for existing Jenkins plugins.
Testing done
mvn compilenew IdMatcher("id")) continues to workSubmitter checklist
This PR modernizes the credentials plugin matcher implementations by converting them from traditional classes to Java records (Java 14+).
Changes:
This change aligns with modern Java best practices while preserving backward compatibility for existing Jenkins plugins.
Testing done
mvn compilenew IdMatcher("id")) continues to workSubmitter checklist