top | item 42528777 (no title) ddimitrov | 1 year ago What is the advantage compared to established AOP libraries, such as AspectJ or BytecodeBuddy? discuss order hn newest gabizou|1 year ago 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. sgolestane|1 year ago Both of these use ASM under the hood
gabizou|1 year ago 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.
gabizou|1 year ago
- 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.
sgolestane|1 year ago