Hacker News new | past | comments | ask | show | jobs | submit login

I kind of wish Java just went full Objective-C and provided native APIs to patch and redirect methods. Having everyone ship a bytecode manipulation library just to mock a method or two is quite annoying given how easy it would be for the runtime to offer this directly (and probably more performantly).





The applications for Mixin wasn't to mock a method or two, it's to enable full-scale modification of an existing Java application at runtime without recompiling/redistributing the original application. In the case of its origins, modifying Minecraft server to add a non-obfuscated API and implement said API on top of it through Mixins. The way this is achieved is practically at the class load point in time so the runtime costs are reduced to maybe a couple of seconds (as of current writing, Sponge has somewhere around 1.2k mixins overall). Could there be a better native API? I'm hoping so, Java's Class File API (JEP-484) is a pretty good start, but I don't think it's quite enough yet to enable the full functionality of what Mixin does.

[1]:https://openjdk.org/jeps/484


Not sure if this fits, but JDK 24 includes a new API, java.lang.classfile, for classfile manipulation.

https://openjdk.org/jeps/484


Is their a design document, somewhere about this new library ?

The jep does not explain how to prepare to new Java bytecodes and future enhancements. Am i suppose to only run with the latest version of Java if i want to use that library ?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: