Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cchantep
Copy link
Member

No description provided.

@gmethvin gmethvin merged commit 54b54ea into playframework:2.5.x Aug 15, 2016
@marcospereira marcospereira added this to the 2.5.5 milestone Aug 17, 2016
case NoSymbol => c.abort(c.enclosingPosition, "No apply function found")
case s => s.asTerm.alternatives
case s => s.asTerm.alternatives.filter {
_.asMethod.paramLists.size == 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the restriction?

@alexdupre
Copy link
Contributor

This change broke serialization of case classes with multiple arguments list, is it intended?

@cchantep
Copy link
Member Author

I don't see how it can break the JSON serialization, as such classes were just not supported before (compilation error), while the API is unchanged.

@OlegYch
Copy link
Contributor

OlegYch commented Aug 22, 2016

it was working before http://scastie.org/21867
doesn't work now http://scastie.org/21868 :(

@cchantep
Copy link
Member Author

Writes could have "accidentally" worked with such multi parameters constructors, even if never documented, but the reads and format didn't and cannot. The macros now enforce explicitly and in all the case this same restriction: no multi param constructor for case classes (break coherence between apply/unapply.

@OlegYch
Copy link
Contributor

OlegYch commented Aug 22, 2016

i'm just pointing out that 2.5.5 is no longer compatible with 2.5.4

@cchantep
Copy link
Member Author

It's binary and API compatible, and also fixes macro incoherencies about an undocumented/not recommanded case. Not it can be said to "break", but it can be documented now.

@OlegYch
Copy link
Contributor

OlegYch commented Aug 22, 2016

i've created an issue #6476 as it is very clearly a breaking change for us

@kpmeen
Copy link

kpmeen commented Sep 5, 2016

I understand that the restrictions described previously in this thread applies for more than one parameter lists. But I'm also getting the 'No apply function found matching unapply parameters' message when I have a generic case class more than 1 generic parameters in the same param list. Like so:

case class Interval[T](base: T, tolerance: Option[T])

implicit val intFmt: Format[Interval[Int]] = Json.format[Interval[Int]]

I would expect that to work, or?

@cchantep cchantep deleted the backport/5384 branch September 5, 2016 20:21
@cchantep
Copy link
Member Author

cchantep commented Sep 5, 2016

@kpmeen I guess this is more related to #5261: the following case class with multiple generic parameter (not recursive) is working fine. There is no change about that for now.

case class Interval[T](base: T, tolerance: T)

@kpmeen
Copy link

kpmeen commented Sep 6, 2016

ah...ok. Thanks @cchantep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants