When working with JSON in Java, Jackson’s JsonNode tree model is a popular choice — especially in framework code that processes or transforms data. But what if you want to query that tree using flexible JsonPath expressions?
Jayway JsonPath is a powerful tool, but using it with pre-parsed Jackson trees isn’t as obvious as you’d think — especially when you’re aiming for safe, predictable behavior in production.
In this post, I’ll share a few techniques I found helpful for reliably applying JsonPath to JsonNode trees, making your queries safer, clearer, and better suited to framework-level code.
Continue reading →
Great post on inheritance from the Sicpers blog, and why — as a concept — it often fails in OO languages such as Java.
This blog post can help you understand why:
- “Cat and Dog extend Animal” is poor use of OO.
- “Square extends Rectangle” is poor use of OO.
From my own experience, I’ve moved to primarily using inheritance in only two ways: Continue reading →
Last week I had to debug some unstable tests, which were only launched externally from Ant (launched from Maven). The tests were largely not directly runnable from the IDE, and did not run equivalently.
Obviously this is outdated practice and not good TDD, but sometimes we need to work with such assets anyway 🙂
Given that, how could I debug & fix these tests? Continue reading →
When investigating complex issues with Maven or command-line tools, it is often helpful to capture the output to a file for further analysis.
This tip shows how to capture both ‘stdout’ and ‘stderr’ to capture a complete authoritative output. Continue reading →
This is a confirmed JDK bug. Just three lines of code to crash the Windows JVM.
Continue reading →
Oracle, with lead engineer Brian Goetz, have launched an experimental OpenJDK project to bring long-awaited features to the Java platform.
Major enhancements to generics & new ‘value types’ are planned. Highlights include:
- Value Types; highly-efficient small ‘objects’ without inheritance.
- Reified Generics; retaining their actual type at runtime.
- Generic Specialization; List<int> would be valid & highly efficient.
- ‘volatile’ enhancements.
The effort is named Project Valhalla. Here’s a preview: Continue reading →
Insights into Java coding, OO design & architecture