Bytecode injection for Event object "Massage"

I’ve been hitting the books reading about ASM and the capabilities of the library to walk through an interface and re-writing of the interface for abstracting the Forge events into the domain of Sponge.

The Cliff’s notes version is that Sponge leverages ASM to walk through the target interface and utilizes the Visitor design pattern to inject new functionality into the synthesized event Object.

Just take a look at the source file:

ASMEventListenerHolderFactory.java

I think that the missing parts for the design are which events in Forge need to be massaged into Sponge events. Which properties of those events need to be exposed in the Sponge synthesized event. The note in the about:

// TODO: This is a temporary thing to make PreInit work. The different things needed to make different events work should be abstracted.

is an understatement.

I’d like to work with the developer who is on point for looking into this. Ie., which abstraction pattern was being considered to make this event object “massage” efficient and extensible.

1 Like