Improve setter resolution logic in BaseConfigurator#2825
Improve setter resolution logic in BaseConfigurator#2825timja merged 5 commits intojenkinsci:masterfrom
Conversation
|
@timja Can you review this pr? |
timja
left a comment
There was a problem hiding this comment.
The code seems fine.
The main change is a getter prefixed with is that is not a boolean / Boolean will now be ignored. should be ok.
and then there's some slight changes to do with sub-classes, in the new test the only cases that fail on master seem to be for ambiguous or ordering ones.
Happy enough to take this but there's two minor test improvements that are needed
There was a problem hiding this comment.
Pull request overview
Refactors BaseConfigurator#describe() to deterministically select the most appropriate setter when multiple overloaded setters exist, improving correctness across exact matches, inheritance hierarchies, and ambiguous overloads.
Changes:
- Group setters by property, locate the corresponding getter, and resolve the “best” setter deterministically (avoiding JVM reflection order dependence).
- Add array-handling improvements by converting
Collectioninputs to arrays when the selected setter expects an array. - Add unit tests covering exact match resolution, subtype/supertype selection, Object fallback, ambiguity handling, primitive/wrapper matching, and missing/invalid getter cases.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
plugin/src/main/java/io/jenkins/plugins/casc/BaseConfigurator.java |
Reworks setter discovery/selection and introduces deterministic overload resolution + collection→array conversion for array setters. |
plugin/src/test/java/io/jenkins/plugins/casc/BaseConfiguratorTest.java |
Adds comprehensive tests for the new setter resolution behavior and edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
can you check copilots suggestions (including adding test cases if appropriate) |
Refactor setter resolution logic in BaseConfigurator. Improve how setters are selected when multiple overloads exist.
Key improvements:
Additional changes:
Manual verification:
Your checklist for this pull request
🚨 Please review the guidelines for contributing to this repository.