Skip to content

Preserve setter generic type information during attribute resolution#2867

Merged
timja merged 2 commits into
jenkinsci:masterfrom
somiljain2006:preserve-setter-generics
Jul 11, 2026
Merged

Preserve setter generic type information during attribute resolution#2867
timja merged 2 commits into
jenkinsci:masterfrom
somiljain2006:preserve-setter-generics

Conversation

@somiljain2006

@somiljain2006 somiljain2006 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #2866

This PR fixes a bug in BaseConfigurator where the generic type information declared by a setter could be replaced by the corresponding getter's generic type during attribute resolution.

When a Jenkins plugin declared a broader or wildcard generic type in its setter (for example, List<? extends PriorityStrategy>) but exposed a narrower collection type from its getter, JCasC would use the getter's generic type in place of the setter's declared generic type. As a result, polymorphic HeteroDescribable collections could no longer be configured correctly.

describe() now treats the setter's generic signature as the source of type information. The getter is only used to recover generic information when the setter provides no meaningful generic type.

Testing

  • Added regression tests to BaseConfiguratorTest covering mismatched getter/setter collection signatures.
  • Manually verified the fix using a Jenkins instance configured with the Priority Sorter plugin. A configuration that previously failed with an UnknownAttributesException now loads successfully.

Your checklist for this pull request

🚨 Please review the guidelines for contributing to this repository.

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates the feature works or fixes the issue.

@somiljain2006
somiljain2006 requested a review from a team as a code owner July 11, 2026 06:06

@timja timja left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, may be worth adding an integration test against priority sorter in a follow up too

@timja timja added the bug label Jul 11, 2026
@timja
timja merged commit bfd699d into jenkinsci:master Jul 11, 2026
17 checks passed
@somiljain2006
somiljain2006 deleted the preserve-setter-generics branch July 11, 2026 11:35
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.

Can't configure PrioritySorter after 2071.vea_ed8d491f81

3 participants