tzulitai commented on a change in pull request #7655: [FLINK-11539] Add TypeSerializerSnapshot for TraversableSerializer URL: https://github.com/apache/flink/pull/7655#discussion_r255409804
########## File path: flink-scala/src/main/scala/org/apache/flink/api/scala/codegen/TypeInformationGen.scala ########## @@ -238,10 +243,24 @@ private[flink] trait TypeInformationGen[C <: Context] { val elementTpe = $elementTypeInfo new TraversableTypeInfo($collectionClass, elementTpe) { def createSerializer(executionConfig: ExecutionConfig) = { + val elementSerializer = elementTpe.createSerializer(executionConfig) + + // ------------------------------------------------------------------------------------- + // NOTE: + // the following anonymous class is needed here, and should not be removed + // (although appears to be unused) since it is required for backwards compatibility + // with Flink versions pre 1.8, that were using Java deserialization. + // ------------------------------------------------------------------------------------- + val unused = new TraversableSerializer[${desc.tpe}, ${desc.elem.tpe}]( + elementSerializer, + $cbfStringLiteral) { + + override def legacyCbfCode = $cbfStringLiteral + } + new TraversableSerializer[${desc.tpe}, ${desc.elem.tpe}]( - elementTpe.createSerializer(executionConfig)) { - def getCbf = implicitly[CanBuildFrom[${desc.tpe}, ${desc.elem.tpe}, ${desc.tpe}]] - } + elementSerializer, Review comment: I'm not sure if it'll matter at all, but maybe we should avoid sharing the created `elementSerializer` between the `unused` traversable serializer and the actual returned one. Moreover, it _might_ (again, not 100% sure just a wild guess) have some unknown / undiscovered implications with the generated anonymous classname. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services