3 ms·
Note that Java now has its own API for this purpose. https://openjdk.org/jeps/484 https://openjdk.org/jeps/484
by pjmlp 1y ago
Note that Java now has its own API for this purpose.
https://openjdk.org/jeps/484 https://openjdk.org/jeps/484
- atomicnumber3 1y agofor 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.
- pjmlp 1y agoHence the now on my comment. :)
- brabel 1y agoHow does that compare in terms of usability and completeness?
- cogman10 1y agoIt'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/ https://asm.ow2.io/
- pjmlp 1y agoI 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.
- cogman10 1y agoYup, 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.
- aardvark179 1y agoIt 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.
- zappb 1y agoIdeally, tools like ByteBuddy will adopt that API as it's for low level concerns.
- lbalazscs 1y agoWe are already living in an (almost) ideal world: https://github.com/raphw/byte-buddy/discussions/1798 https://github.com/raphw/byte-buddy/discussions/1798
- kiicia 1y agoWasn’t there already like instrumentation api that was run via premain?
- zappb 1y agoThat 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.