-
Notifications
You must be signed in to change notification settings - Fork 502
Closed
Closed
Support refactoring based on an annotation that provides the replacement template (e.g.
@InlineMe)#5400Feature
Copy link
Labels
Description
What problem are you trying to solve?
Automated transformations via type attribution and annotations.
Tim asked about automating refactoring during the KotlinParser development using deprecated annotations.
I thought it might be possible to create an OR annotation like DeprecatedX(...), where the annotation arguments provide information about how to handle a migration.
Describe the solution you'd like
- The annotations could be target-site specific, like METHOD, CLASS, etc.
- OR would own the annotation, and its existence could trigger a recipe.
- The type-attribution on a class, method, etc., may have arguments that provide contextual instructions on the migration.
class Example {
// I don't recall what is available in the annotation arguments, but I imagine something could be sorted out.
@org.openrewrite.DeprecatedMethod("methodMatcherSig", "someTransformationToMethodB")
void methodA(...) {...}
// Method calls of `methodA` would be migrated to `methodB`.
void methodB(...) {...}
}Have you considered any alternatives or workarounds?
No, this was just a thought. This may already exist, but I haven't tracked all the changes across OR for awhile.
Are you interested in contributing this feature to OpenRewrite?
I'm pretty busy at the moment, but anything is possible!
timtebeek
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done