I can't find a single example of how @:classCode
is used (to inject a native member directly into the file). This fails with Unexpected untyped
at compile time:
@:classCode
untyped __java__("public void paintComponent(Graphics g) {doStuff();}");
I can't simply use standard Haxe code to have a paintComponent()
method because of the way Haxe eats @:overload
methods (and forces use of @:overload
in the first place).
There are some examples of it in the Haxe standard library, for instance:
@:classCode('override public string Message { get { return this.toString(); } }\n\n')
@:nativeGen @:keep @:native("haxe.lang.HaxeException")
private class HaxeException extends Exception
Looks like the class code metadata has a string argument containing the code to be inserted and should be used on a class declaration.