That is an even lower level API that lets you manipulate the bytecode as a byte array. You still need to parse it to do anything useful, hence libraries like ASM. And if you want to compile more code at runtime (or generate bytecode), you'll need some way to do that.
It is complete, and I’ve found it extremely usable when writing code to trawl over a large number of class files. Looks like it should be good for code generation as well but I haven’t used that yet.
Yup, the ASM dependency is one that would constantly cause us headaches. A load of frameworks have a path to ASM for one reason or another and it requires an update every time you move up JVM runtimes.
It's usually not painful to update (just bump the version) but it's an annoyance.
for those who might be clicking through thinking "since when??", the emphasis is on "now" - this was released in JDK 24.
bytebuddy predates it by at least a decade.
Hence the now on my comment. :)
Ideally, tools like ByteBuddy will adopt that API as it's for low level concerns.
We are already living in an (almost) ideal world: https://github.com/raphw/byte-buddy/discussions/1798
Wasn’t there already like instrumentation api that was run via premain?
That is an even lower level API that lets you manipulate the bytecode as a byte array. You still need to parse it to do anything useful, hence libraries like ASM. And if you want to compile more code at runtime (or generate bytecode), you'll need some way to do that.
How does that compare in terms of usability and completeness?
It is complete, and I’ve found it extremely usable when writing code to trawl over a large number of class files. Looks like it should be good for code generation as well but I haven’t used that yet.
I have not yet used it, only raising awareness.
This came to be, because Oracle noticed everyone, including themselves, were depending on ASM, so the JEP was born.
Yup, the ASM dependency is one that would constantly cause us headaches. A load of frameworks have a path to ASM for one reason or another and it requires an update every time you move up JVM runtimes.
It's usually not painful to update (just bump the version) but it's an annoyance.
In fact, Byte buddy has a dep on ASM.
It's complete but low level compared to Byte Buddy. A better comparison is the to ASM (which is what it was meant to replace).
https://asm.ow2.io/