https://kotlinlang.org logo
#getting-started
Title
# getting-started
k

Kshitij Patil

12/13/2023, 4:29 PM
What’s the recommended tool/library to execute a major code rewrite of kotlin codebase which is not doable with simple find-replace Say we use one library which has certain methods, annotations and there’s exist a new library with one-to-one mapping for each use case in old library. Given there’s a fixed pattern on how code should be re-written using new library, is there a way to automate this process using code parser My initial hunch is to use kotlin-embeddable or kotlin-poet but not sure if I’ll be able to maintain line numbers and keep rest of the codebase untouched
j

Javier

12/13/2023, 4:35 PM
If automap is possible, do you even need mapping? Looks like duplicated model.
c

Casey Brooks

12/13/2023, 5:02 PM
Intellij’s Structural Search and Replace might be an option. More powerful than a standard text or regex search, but doesn’t need to drop down to parsing and modifying AST
💯 3
o

Oliver Eisenbarth

12/13/2023, 5:51 PM
s

Stephan Schröder

12/14/2023, 7:25 AM
OpenRewrite doesn't have that many recipes for Kotlin though: https://docs.openrewrite.org/recipes/kotlin
2 Views