Avoid BootstrapMethodError errors during serialization #343
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.
This PR fixes #342 by replacing some of the function literals in generated code with explicit
FunctionN
values. Specifically thearbTupleN
instances inArbitraryArities
now useGen.zip
, and all of theGen.zip
implementations now useflatMap
andnew Function1
instead offor
-comprehensions.Explicitly instantiating
FunctionN
values instead of using function literals means that we avoid this Scala 2.12 bug and the underlying JVM 8 limitations without having to use-Ydelambdafy:inline
to get the old lambda encoding everywhere.This doesn't affect binary compatibility but it does mean that the 2.12 jars are bigger. The
Gen.zip
implementations could probably be changed back once 2.12.3 is released with this fix, but I think thearbTupleN
change is a little nicer anyway (and doesn't contribute to the jar size blowup).I've added tests that fail on 2.12 with the
BootstrapMethodError
in #342 without this change.I'm happy to reformat if needed (some of the code-gen-ed lines are now pretty long).