Skip to content

Serialization of Enumeration bug? #66

slorber opened this Issue Apr 10, 2013 · 11 comments

2 participants

slorber commented Apr 10, 2013


I have posted the problem on StackOverflow:

Any idea?

slorber commented Apr 12, 2013

Does your recent changes on Enumeration (@JsonScalaEnumeration(classOf[WeekdayType])) fixes this problem?

FasterXML, LLC member

Not specifically; the recent changes on the master branch are targeting version 2.2, yet to be released. The bug report is on the 2.1 version, and I've not yet been able to reproduce your specific issue.

If you'd like to try the latest 2.2 version, I've made them available on the Sonatype OSS Snapshots repository:;gav~com.fasterxml.jackson.*~~2.2.0-SNAPSHOT~~

slorber commented Apr 14, 2013

One important thing I didn't notice at first is that the 2 classes on my SO question: SimpleCaseClass / SimpleCaseClassWithEnum.
They are in my test method local case classes!

I upgraded to 2.2.0 and the serialization of these classes which used to work now produces an empty string {}.

By moving them outside the method I get an exception:

Caused by: java.lang.NullPointerException: null
    at com.fasterxml.jackson.module.scala.introspect.ScalaClassIntrospector$.isMaybeScalaBeanType(ScalaClassIntrospector.scala:15) ~[jackson-module-scala_2.10-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
    at com.fasterxml.jackson.module.scala.introspect.ScalaClassIntrospector$.constructPropertyCollector(ScalaClassIntrospector.scala:28) ~[jackson-module-scala_2.10-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
    at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.collectProperties( ~[jackson-databind-2.2.0-SNAPSHOT.jar:2.2.0-SNAPSHOT]
slorber commented Apr 14, 2013

By the way, the 3rd test with my real case class Relationship (not method local), it now works as expected, with or without the annotation.

By the way, another important thing to mention because I took a look at ScalaClassIntrospector sources: my method local case classes moved outside the method didn't have any package!

slorber commented Apr 14, 2013

So in the end my bug seems to be fixed and the new annotation seems to work fine.


  • There is a NPE for case classes with no package
  • Since 2.2.0 we can't serialize inner case classes (in object or method) anymore, it produces empty json object

Thanks for fixing this quickly.

By the way, I don't really understand the Jackson world, why are there 2 packages (codehale vs fasterxml?).
And what is your position compared to Jerkson? Jerkson seems abandonned, is your project some kind of "continuation" of Jerkson?

FasterXML, LLC member

Thanks for the bug report on case classes with no package, I'll look into that. Inner case classes have never been fully supported, though there were edge cases where they may have worked. It's something I would like to solve generally in a future release.

I'm not aware of any 'codahale' packages for Jackson other than Jerkson. Jerkson was Coda's extension of Jackson for Scala, developed independently of this module. Since Yammer is moving away from Scala as an implementation language, Coda's Scala related work is being deprecated in favor of other alternatives.

I will open new issues to track the NPE and inner case class problems you reported.

slorber commented Apr 15, 2013

Ok thanks. I didn't know Jerkson was from Yammer and I though Codahale was an organisation releasing Jackson... (was confused because of Codahale / Codehaus)

slorber commented May 7, 2013

By the way one of our developers had this error:

[RuntimeException: java.lang.UnsupportedClassVersionError: com/fasterxml/jackson/module/scala/JsonScalaEnumeration : Unsupported major.minor version 51.0]

I guess it's because he's using an old JRE while you compiled the library with JDK7.
Perhaps you should compile it with -target 1.6 or something so that it is compatible with more JRE

slorber commented May 7, 2013

By the way, she didn't have this error before this change:

  • "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.2.0-SNAPSHOT",
  • "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.2.0",

So I guess the snapshot was compatible with JDK6 while the official release is not :)

FasterXML, LLC member

Yes, this was clearly a bad build created on my end. I'll look into what it takes to get a replacement build out ASAP. I'm hopeful I'll be able to retain the same version number, but I don't know if the Maven ecosystem will let me do that.

FasterXML, LLC member

I've staged a potential replacement version on the Sonatype OSS Maven repository. You can download the 2.2.1 version for your either directly from the repository website, or by adding a reference to the repository to your build (instructions below). Let me know if you have a chance and can validate that this new build works for you.

<!-- For maven
  <name>Fasterxml Staging</name>
// For sbt
resolvers += "Fasterxml Staging" at ""
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.