by gavinray · 3y ago · 0 comments
---
One of the coolest things that's been worked on (by this same author, no less!) isn't even in the article!
Per has written a pretty-printer for MemorySegments and ByteBuffers that can hex-dump memory or render memory/buffers as their "struct" representations given some MemoryLayout.
You can also customize it with your own printers, it's wicked cool and helps so much to debug buffers when working with them.
https://github.com/openjdk/panama-foreign/pull/695
What do I mean by that? Have a look at this comment for an image of a raw memory structure layout I represented with MemoryLayout, and the pretty-print rendering of it:
https://github.com/openjdk/panama-foreign/pull/695#issuecomm...
It looks like something I'd expect to either be an external tool (like VisualVM) or part of an IDE
Except when they use @Autowired. (Ackshually aside, I do agree with the sentiment of your post. The standard library is arguably one of Java's greatest assets)
Sorry for the tangent, it had to get out somewhere and I did not think it was worthy of an email in the actual review thread : - )
When I saw your top-level comment, I must have mixed up your name with a different Gavin [1] until a quick Google search fixed the mix up :)
1: Gavin King of Hibernate fame.