
Killing Reflection at Build Time: Avro, Codename One and Java Codegen (#103)
Runtime reflection is a quiet tax on the JVM. It is flexible, it is everywhere, and it is easy to stop noticing it until you go looking for where your CPU is actually going. Two teams did exactly that, in completely different corners of the ecosystem, and arrived at the same answer: move the work to build time. In this episode, Dmitry Moskalyuk explains the model layer behind his Foojay article on reflection-free serialization, where JSON, XML, YAML and TOML all end up as Avro. Shai Almog explains the build-time codegen pipeline of Codename One, which aims for no reflection, no service loader and no Class.forName. We compare the two and ask whether generated code is really something to avoid. Topics include: Where Jackson's reflection cost really lives, and what Blackbird does about it Jackson versus kotlinx.serialization, and why a missing feature sent the team back to Jackson Why a UI framework bans reflection, and how that differs from the backend Is generated code bad? Lombok, Manifold and jOOQ What Records and Project Leyden change for reflection Build time cost versus runtime cost, and a single source of truth for your data model Should you still use reflection in a new project? Guests: Dmitry Moskalyuk, Senior Backend Engineer Dmitry on LinkedIn Shai Almog, Author, DevRel and open source developer working on Codename One Shai on LinkedIn Links: Dmitry's article on Foojay Shai's article on Foojay Jackson Blackbird Apache Avro Project Leyden Full show notes with every link Timestamps: 00:00 Introduction of topic and guests 01:50 About the new Foojay, contributing with GitHub pull requests 03:17 What is Apache Avro 04:26 What is Codename One 06:31 What is Blackbird in Jackson and compared to kotlinx mechanisms for different content parsers 10:01 Why Codename One focuses on "no reflection, no service loader, no Class.forName" 14:23 Is automatically generated code bad (Lombok, Manifold, JOOQ)? 17:47 Java evolutions that bring improvements into the system (Records, Project Leyden) 21:31 Is reflection changing through Java versions? 24:29 Build time cost versus runtime, Project Leyden 28:41 Use of reflection in UI versus backend 32:16 Benefit of your data model in a (Java) object, having one source of truth, good debugging 35:35 Should you worry about serialization in a small project 37:38 Serialization and security 38:57 Should I still use reflection/serialization in a new project? 43:22 Conclusion














