Skip to content

Introduce mechanism for programmatic extension management #506

Description

Background

This issue addresses some of the topics discussed in #112.

Status Quo

It is currently possible to register extensions declaratively via @ExtendWith on types and methods, and #497 will support programmatic extension registration via fields. However...

  • Developers cannot alter the order of registered extensions.
  • Developers cannot remove a registered extension.
  • Developers cannot insert an extension into the list of registered extensions -- for example, at the front or somewhere in the middle.

Rationale

In order to avoid the introduction of an overly complex declarative model for sorting, appending, prepending, inserting, and removing extensions, we have opted for a programmatic means to achieve all of the above. Providing a programmatic means to achieve these goals frees developers to manage registered extensions as they see fit without any unnecessary restrictions imposed on them by the framework itself.

Considerations

Such a mechanism could itself be an Extension registered declaratively via @ExtendWith; however, the current thinking in the team is that there should be one and only one such component registered at any given time. Since this is such a special case which affects all extensions which have been registered declaratively, it is therefore considered best to introduce a new declarative mechanism for registering this single component. Similarly, the API for such a component should therefore not extend Extension since doing so would allow users to incorrectly register it via @ExtendWith (in which case it would simply be silently ignored).

Proposal

  • Introduce an ExtensionManager API that receives a list of all registered extensions as input and returns a list of extensions.
  • Introduce a @ManageExtensionsWith annotation that allows the user to declare a single class reference for an implementation of ExtensionManager.

Related Issues

Deliverables

  • Introduce a mechanism for programmatic extension management.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions