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

What is the advantage compared to established AOP libraries, such as AspectJ or BytecodeBuddy?





A primary advantage of Mixin is using Java as a DSL to apply various kinds of bytecode transformation with some examples here:

- Changing a constant within a target method https://github.com/SpongePowered/Sponge/blob/06ebd1d3479b9ed...

- Replacing a method call within a specific method https://github.com/SpongePowered/Sponge/blob/06ebd1d3479b9ed...

- Adding an interface and its implementation to the target class (in this case net.minecraft.world.entity.Entity will now implement org.spongepowered.api.entity.Entity and its methods) https://github.com/SpongePowered/Sponge/blob/06ebd1d3479b9ed...

There's a fair bit more that is possible that would otherwise require a fair bit more code wrangling with AspectJ or BytecodeBuddy to achieve the same effects.


Both of these use ASM under the hood



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

Search: