Skip to content

Fix for issue with Lift-JSON occassionally choosing wrong constructor, resulting in erroneous serialization #3

Open
wants to merge 3 commits into from

2 participants

@wfaler
wfaler commented Feb 26, 2011

On decomposing a case class Lift-JSON will pick a constructor to base it's decomposition on with the "primaryConstructorArgs"-function, which previously picked the first available constructor.

However, the JVM does not guarantee the ordering of constructors, so in the case of classes with multiple alternative available constructors, the behavior becomes unpredictable and indeterminable.

I fixed this so that "primaryConstructorArgs" always picks the declared Constructor with the most arguments, as I felt this is a more reasonable assumption on the primary constructor for a case class to be serialized to JSON.

Let me know if this is acceptable, or if you want any changes.

@bethbodekor

love it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.