
Dye
Dye is a library and modloader service that provides mod developers with access to the JVM INVOKEDYNAMIC opcode. If you are a mod developer and want to learn details about using this technology, refer to the corresponding documentation.
Technical explanation:
The Java Virtual Machine (JVM) has an opcode called INVOKEDYNAMIC. Each individual occurrence of this opcode in bytecode is permanently bound to a CallSite object when first executed. This CallSite is obtained by calling a bootstrap method, which is implemented in plain Java. This mechanism, for example, is used to implement lambda expressions in bytecode.
Dye provides a transformation service that replaces regular method calls to methods annotated with a special annotation with INVOKEDYNAMIC opcodes to a custom bootstrap method specified in the annotation value.