Thanks for the quick response, Stephen, that makes sense. > Is it a problem for your use case to make the constructor public?
It's not a huge problem, I was mostly just curious as to what the problem was exactly. On Thu, Mar 3, 2016 at 2:14 PM, Stephan Ewen <se...@apache.org> wrote: > Hi! > > My guess is that this error is indirectly reporting that no > TypeInformation could be generated for the case class. That TypeInformation > is generated using macros during program compilation. > > The generated TypeInformation will contain a partially code-generated > serializer including the code to instantiate the case class upon > deserialization. That generated code at some point calls the constructor > and thus probably fails to compile when the constructor is private. As a > result, no TypeInformation will be created, and then Scala cannot provide > one for the implicit parameter. > > I think Aljoscha can probably give a deeper insight into the > TypeInformation generator for Scala. > > Is it a problem for your use case to make the constructor public? > > Greetings, > Stephan > > > On Thu, Mar 3, 2016 at 9:06 PM, Andrew Whitaker < > andrew.whita...@braintreepayments.com> wrote: > >> Hi, >> >> I've run up against a compilation error involving a case class with a >> private constructor: >> >> [error] >> /Users/anwhitaker/code/flink-fold-issue/src/main/scala/TestApp.scala:18: >> could not find implicit value for evidence parameter of type >> org.apache.flink.api.common.typeinfo.TypeInformation[List[scala.util.Try[TestApp.Wrapper]]] >> [error] .fold(List[Try[Wrapper]](), new FoldFunction[Tuple2[Int, >> Int], List[Try[Wrapper]]] { >> [error] ^ >> [error] one error found >> [error] (compile:compileIncremental) Compilation failed >> >> If I make the constructor public again, the error goes away. I've set up >> a simple example that demonstrates the problem here: >> https://github.com/AndrewWhitaker/flink-case-class-private-ctor >> I've read this article on Flink's website: >> https://flink.apache.org/faq.html#why-am-i-getting-a-nonserializableexception- >> but I think my issue is slightly different. >> >> I'm just trying to understand this behavior and if there's a way I can >> work around it. >> >> Thanks! >> >> -- >> Andrew Whitaker | andrew.whita...@braintreepayments.com >> > > -- Andrew Whitaker | andrew.whita...@braintreepayments.com -- Note: this information is confidential. It is prohibited to share, post online or otherwise publicize without Braintree's prior written consent.