On Fri, May 15, 2020 at 9:25 PM Adam Zell <[email protected]> wrote: > > With the popularity of Java frameworks that enable native images rising > (Quarkus, Micronaut, Helidon, Spring Boot, etc.), minimizing reflection is > becoming a best practice. > > JSON parsers like https://github.com/square/moshi/#codegen and > https://github.com/ngs-doo/dsl-json#java8-annotation-processor can remove or > minimize run-time reflection by utilizing code generation. Is there an > interest in supporting the same feature in Jackson? I am assuming that > https://github.com/FasterXML/jackson-docs/wiki/Presentation:-Jackson-Performance#compatible-easy-afterburner > does something similar but again at run-time.
There probably is interest, as there are cases where this would be beneficial, but I am not aware of anyone working on this. There are couple of aspects to runtime introspection; in particular annotation access (typically "one-time" overhead for inspecting all annotations to figure out settings for (de)serializers), and then actual property set/get via reflection. Afterburner does second case, dynamically (so after usual annotation introspection dynamic accessors and constructor callers are generated). I suspect both cases could be covered, possibly separately. First case (annotation access) alternative could, for example, be exposed via different `AnnotationIntrospector` feeding settings, and could be useful for reducing start-up overhead on serverless platforms, and Android (where annotation access is hideously slow for some reason). Second case (generating accessors) can be addressed in many ways as well; some tools generate source code to compile (and I think this is nowadays more common one, and probably easier). Extending Afterburner could theoretically work, but one problem is that Afterburner uses standard reflection access as fallback where needed, and this is probably not something that would be practical if all reflection access was to be replaced. -+ Tatu +- -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/CAL4a10h12EtN%3D-iff5JVpsEairZF7Fn1ndfvAAwzGDPgXeNHSw%40mail.gmail.com.
