We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5a42a6d commit 4ca175eCopy full SHA for 4ca175e
src/main/scala/tools/jackson/module/scala/deser/ScalaObjectDeserializerModule.scala
@@ -10,10 +10,15 @@ import tools.jackson.module.scala.JacksonModule.InitializerBuilder
10
import tools.jackson.module.scala.util.ClassW
11
12
import scala.languageFeature.postfixOps
13
+import scala.util.control.NonFatal
14
15
private class ScalaObjectDeserializer(clazz: Class[_]) extends StdDeserializer[Any](classOf[Any]) {
16
override def deserialize(p: JsonParser, ctxt: DeserializationContext): Any = {
- clazz.getDeclaredFields.find(_.getName == "MODULE$").map(_.get(null)).getOrElse(null)
17
+ try {
18
+ clazz.getField("MODULE$").get(null)
19
+ } catch {
20
+ case NonFatal(_) => null
21
+ }
22
}
23
24
0 commit comments