Skip to content

Skip meta-annotated @Configuration in FinalClass and HideUtilityClassConstructor#867

Merged
timtebeek merged 1 commit intomainfrom
tim/skip-test-config
Apr 28, 2026
Merged

Skip meta-annotated @Configuration in FinalClass and HideUtilityClassConstructor#867
timtebeek merged 1 commit intomainfrom
tim/skip-test-config

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Apr 28, 2026

Summary

  • Flip the AnnotationMatcher for @org.springframework.context.annotation.Configuration to matchesMetaAnnotations=true in both FinalClassVisitor and HideUtilityClassConstructorVisitor, so classes annotated with @TestConfiguration, @SpringBootApplication, or any other stereotype layered on top of @Configuration are skipped for the same proxy/CGLIB reasons.

  • Add regression tests covering @TestConfiguration for both recipes.

  • Addresses FinalClass and HideUtilityClassConstructor should not apply for Spring Configuration classes #729 (comment).

Test plan

  • ./gradlew test --tests FinalClassTest --tests HideUtilityClassConstructorTest

…ClassConstructor`

Enables meta-annotation matching so classes annotated with `@TestConfiguration`,
`@SpringBootApplication`, and any user-defined stereotype layered on top of
`@Configuration` are also skipped.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Apr 28, 2026
@timtebeek timtebeek merged commit d3e09e9 into main Apr 28, 2026
1 check passed
@timtebeek timtebeek deleted the tim/skip-test-config branch April 28, 2026 11:39
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant