Skip to content

127 allow bean removal#128

Open
mateuszNalepaAllegro wants to merge 8 commits into
mainfrom
127-allow-bean-removal
Open

127 allow bean removal#128
mateuszNalepaAllegro wants to merge 8 commits into
mainfrom
127-allow-bean-removal

Conversation

@mateuszNalepaAllegro

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread RECIPES.md Outdated
Comment thread RECIPES.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces a new internal OpenRewrite recipe intended to remove simple, annotated factory methods (e.g., Spring @Bean-like methods) and documents/tests this behavior in the allwrite-recipes module.

Changes:

  • Added RemoveAnnotatedMethod recipe (internal) with configurable annotation, return type, and allowed body method calls.
  • Added comprehensive cross-language (Kotlin/Java/Groovy) tests for method-removal eligibility rules.
  • Extended RECIPES.md with documentation for the new recipe.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
RECIPES.md Adds documentation for RemoveAnnotatedMethod (needs corrections to match implementation/package).
allwrite-recipes/src/test/kotlin/pl/allegro/tech/allwrite/recipes/spring/RemoveAnnotatedMethodTest.kt Adds JUnit/RewriteTest coverage for removal behavior across Kotlin/Java/Groovy.
allwrite-recipes/src/main/kotlin/pl/allegro/tech/allwrite/recipes/spring/RemoveAnnotatedMethod.kt Introduces the new internal recipe implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread RECIPES.md Outdated
Comment thread RECIPES.md Outdated
Comment thread RECIPES.md Outdated
Comment thread RECIPES.md
@mateuszNalepaAllegro
mateuszNalepaAllegro marked this pull request as ready for review July 21, 2026 08:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

RECIPES.md:727

  • In the options table, returnType/annotationName are marked as Required=Yes, but their descriptions say the recipe is a no-op when they are null. These two statements contradict each other; the docs should reflect one consistent contract.
| Name               | Type          | Required | Description                                                                                                                                                                            |
|--------------------|---------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `returnType`       | `String`      | Yes      | Fully qualified return type of the method to remove. If `null`, the recipe is a no-op.                                                                                                 |
| `annotationName`   | `String`      | Yes      | Fully qualified annotation name the method must have. If `null`, the recipe is a no-op.                                                                                                |
| `allowedBodyCalls` | `Set<String>` | No       | Simple method calls permitted in the method body. Any call to a method not in this set blocks removal. Defaults to empty set - only methods with no body calls are removed by default. |

Comment thread RECIPES.md Outdated
Any call not in this set causes the method to be treated as complex and skipped""",
required = false,
)
public val allowedBodyCalls: Set<String> = emptySet(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The allowedBodyCalls is a pretty cryptic name, without the examples I wouldn't be able to understand what it does 😛

How about ignoredMethodNames? We could explain it like this:

By default, any method invocation within the bean method prevents the bean from being removed. You may specify a list of method names that should be ignored during this check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants