rewrite icon indicating copy to clipboard operation
rewrite copied to clipboard

Allow Traits visitors to schedule after visitors

Open timtebeek opened this issue 8 months ago • 1 comments

What problem are you trying to solve?

Traits are great to simplify development, but can not be used when changes to imports are needed, as the required hooks to register a doAfterVisitor are not exposed.

Describe the solution you'd like

Allow traits to call doAfterVisit, or similar, to register imports to be added/removed for wider applicability.

Have you considered any alternatives or workarounds?

Use the Traits visitor only within another visitor, but this is awkward and might even be more confusing.

Additional context

As seen on the AssertEqualsToAssertThat example, where the imports make it impossible to switch to a Trait.

timtebeek avatar May 17 '25 00:05 timtebeek

I also remember stumbling over this limitation when I implemented the ShortenFullyQualifiedTypeReferences utility, which I wanted to be part of JavaTemplate.

knutwannheden avatar May 17 '25 04:05 knutwannheden

This issue is stale because it has not had any activity for 60 days. Remove question label or comment or this will be closed in two weeks. Issues may be reopened when there is renewed interest.

github-actions[bot] avatar Jul 28 '25 11:07 github-actions[bot]