[Scala] extract abstract scala codegen #3755
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates) – regenerated all scala related samples:scala
,async-scala
,scalatra
,akka-scala
)and.2.3.0
branch for breaking (non-backward compatible) changesDescription of the PR
This extracts a common super class for AkkaScalaClientCodegen, AsyncScalaClientCodegen, ScalaClientCodegen, ScalatraServerCodegen, which cleans up some duplicated code. This is a prerequisite to fixing #3738 (which will be done in a second pull request – #3757 – building on this one).
I tried to do it in a minimally invasive way – the results should be the same as before. In the petstore samples the only difference is that some imports for classes in the same package disappeared (only for
scalatra
).I guess there could be done more, but I'm not so familiar with the Scala generators, and don't know which of the behavior differences is intentional and which not. For example, all classes seem to have different lists of reserved words.
One potential issue:
languageSpecificPrimitives
initialization into the super class – but it had slightly different lists in each of the subclasses. I chose to use the union of all of them, though I'm not sure what the effect would be here. (Any
andSeq
are now primitives for all of them, andscalatra
hadInteger
instead ofInt
.)