[java] Use default method on generated visitor interfaces#1446
Conversation
Invalidates the last generated sources if alljavacc.xml has changed
e02190d to
82aa804
Compare
Generated by 🚫 Danger |
…md into java-visitor-default-methods
adangel
left a comment
There was a problem hiding this comment.
Looks good!
I'm not sure yet about the name of the "SideEffectingVisitor". Is the (long-term) plan, that the SideEffectingVisitor replaces the current JavaParserVisitor?
|
@adangel I don't think new visitor types should replace JavaParserVisitor, but rather they should complement it. Having yet other visitors would help us fit different use cases more closely. E.g. I can see use cases for the following signatures too: void visit(XXNode node); // no parameter, void return type
T visit(XXNode node); // no parameter, generic return typeThese could of course be implemented with a JavaParserVisitor, but it's inconvenient bc of cast and unnecessary parameter. Visitors with different signatures would just be different tools in the toolbox, and I think fleshing out this toolbox now can be beneficial in the long term. Since they can be generated the maintenance cost would be low, the only thing would be that we'd have to add an accept method to each node, for each type of visitor. That would be verbose, but only needs to be done once, so I think long-term it's a good investment. Wdyt? |
Uh oh!
There was an error while loading. Please reload this page.