Skip to content

HeteroDescribableConfigurator fails on duplicate keys. #658

@dgarzon

Description

@dgarzon

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:

  1. jenkins.plugins.git.traits.BranchDiscoveryTrait
  2. org.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleUsed by stale[bot] to mark a issue/PR stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions