I wonder, what the difference between JavaVistitor
and JavaIsoVisittor
is. When shall I use what. This is not clear to me from the documentatio https://docs.openrewrite.org/.
Asked
Active
Viewed 84 times
1

MGK
- 101
- 5
-
Can you please share the link to this javadoc? – MGK Dec 03 '22 at 15:07
1 Answers
0
Did you see the JavaDoc at the top of the JavaIsoVisitor?
/**
* This iso(morphic) refactoring visitor is the appropriate base class for most Java refactoring visitors.
* It comes with an additional constraint compared to the non-isomorphic JavaRefactorVisitor:
* Each visit method must return an AST element of the same type as the one being visited.
*
* For visitors that do not need the extra flexibility of JavaRefactorVisitor, this constraint
* makes for a more pleasant visitor authoring experience as less casting will be required.
*/
public class JavaIsoVisitor<P> extends JavaVisitor<P> {
So whenever you're only replacing elements with elements of the same type, you're able to use the JavaIsoVisitor
.
When you're replacing elements with one or more element of a different type, you will have to use JavaVisitor
.

Tim
- 19,793
- 8
- 70
- 95