I've dug much deeper than I initially planned and made quite some changes to scalagen, but I hope they pay off:
I replaced the Maven build by an SBT one which gives much nicer compilation speed and other goodies and is the de facto standard for most Scala projects.
I transformed the statefull ScalaDumpVisitor into a stateless ScalaStringVisitor which instead of modifying a local SourcePrinter returns Strings in all visit methods.
Formatting is now handled by Scalafmt which gives much more flexibility on how to format code and reduces the complexity of scalagen a little.
The Java parser library is updated to a version that supports Java 8 and the corresponding visit methods implemented, so we should be able to transform Java 8 code (most likely there's some bugs in there, which we can fix as we discover them)
Comments are copied as good as possible. There's still some edge cases where they can get lost, especially when multiple comments occur in a row.
It would be great if you could have a look at this so we can start discussing on how to integrate and release this. If I have time, I'll publish a build on Bintray so that people can already start trying this out and finding bugs :wink:
This PR was originally made in https://github.com/timowest/scalagen/pull/84
I've dug much deeper than I initially planned and made quite some changes to scalagen, but I hope they pay off:
ScalaDumpVisitor
into a statelessScalaStringVisitor
which instead of modifying a localSourcePrinter
returnsString
s in allvisit
methods.visit
methods implemented, so we should be able to transform Java 8 code (most likely there's some bugs in there, which we can fix as we discover them)It would be great if you could have a look at this so we can start discussing on how to integrate and release this. If I have time, I'll publish a build on Bintray so that people can already start trying this out and finding bugs :wink:
Phew, that was a journey! :smile: