-
Notifications
You must be signed in to change notification settings - Fork 742
Description
Please make sure to provide following information in your issue description
- Jenkins version (v. 2.138.3)
- Plugin version (v. 1.3)
- OS (macOS Mojave)
Currently, HeteroDescribableConfigurator is prone to throwing IllegalStateException and ConfiguratorException when 2 or more Descriptor have the same name and are not annotated with the @Symbol. This can be seen when generating the Schema and when Configuring from a YAML.
For example:
Given the following two implementations for BranchDiscoveryTrait that lack the @Symbol annotation:
jenkins.plugins.git.traits.BranchDiscoveryTraitorg.jenkinsci.plugins.github_branch_source.BranchDiscoveryTrait
Then, when generating the Schema we get an IllegalStateException due to a duplicate key in the getImplementors() logic. This is because DescribableAttribute.getSymbols(descriptor, api, target), returns branchDiscoveryTrait for both implementations.
On the other hand, when we configure based on the provided YAML configuration, we get a ConfiguratorException because we are being too optimistic in the sense that we assume that a symbol can only be mapped to one Descriptor implementation. Instead, we should not make such assumption and do a brute-force implementation that will try to instantiate the configured object for N number of Descriptor.