Provides a GWT compiler override to swap out any method call in the app with arbitrarily generated or selected expression statements.
These magic method injections only work in production mode.
The code inside the method is run as-is in gwt-dev and pure JREs.
- Inherit com.google.gwt.MagicMethods
- Create a generator that implements MagicMethodGenerator
- Define a custom property mapping the method to inject with its generator
- <extend-configuration-property name="gwt.magic.methods"
value="some.method.to.replace.Class.method(Ljsni/param/Types;)Ljsni/returnType *= an.implementation.of.MagicMethodTestGenerator"/>
If you do not want to use an instance implementing the generator type,
you may append ::staticMethodName at end of the class after *=
Example: some.package.Type.method()I *= some.package.Class::staticMethodName,
which replaces Type.method() with whatever is generated by Class.staticMethodName.
Note the type signature of staticMethodName must match MagicMethodGenerator.injectMagic.
See the [MagicMethodGenerator] (src/main/java/com/google/gwt/dev/jjs/MagicMethodGenerator.java) and the [UnifyAstListener] (src/main/java/com/google/gwt/dev/jjs/UnifyAstListener.java) interfaces for details.
The GWT Reflection API makes extensive use of magic method injection.