Giter Site home page Giter Site logo

Comments (4)

christophercurrie avatar christophercurrie commented on May 23, 2024

Thanks for the bug report. I seem to recall that the reflection mechanism I'm currently using might have issues with inner classes. The reason (IIRC) is that the system uses the ScalaSig system to get run-time type information, which is only available on the top level. Another way of putting it, BarTuple is path-dependent, each instance of BarTuple is tied to a specific Bar. Since, in context, Jackson doesn't know anything about the parent Bar, it may have a hard time doing the right thing in this case, short of some stack trace inspection to see if the parse method is being called from within the parent class of BarTuple.

But I'll spend some time looking into what might be done. I also hope that the forthcoming Scala 2.10 will provide better reflection tools for these use cases.

from jackson-module-scala.

christophercurrie avatar christophercurrie commented on May 23, 2024

Have done more reading on this issue, and on the support that is within core Jackson for this use case. The relevant bug report for when support for this was added to Jackson demonstrates that this is possible in the context of deserializing an instance of the containing class.

So in the case above, BarTuple cannot be deserialized alone, but if BarParse where a bean type, that contained a BarTuple as a value, then that would be deserialzed properly. The test added in fe15b83 demonstrates that this works correctly.

from jackson-module-scala.

ScottPierce avatar ScottPierce commented on May 23, 2024

@christophercurrie

Still seeing this issue on 2.3.2 on inner case classes generated by Slick. The following case class is inside a generated trait named Tables

case class User(id: Int, email: String, password: String, firstName: String, lastName: String)

Error:
Caused by: java.lang.IllegalArgumentException: Argument #0 of constructor [constructor for db.Tables$User, annotations: [null]] has no property name annotation; must have name when multiple-paramater constructor annotated as Creator at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findValueInstantiator(BasicDeserializerFactory.java:287) at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildBeanDeserializer(BeanDeserializerFactory.java:266) at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:168) at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:401) at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:350) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:263) ... 30 more

from jackson-module-scala.

christophercurrie avatar christophercurrie commented on May 23, 2024

Can you open an new issue, and provide a more complete code sample, preferably without a dependency on Slick?

from jackson-module-scala.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.