Hi,
I am a Groovy developer at work, and am trying to switch my sons
Minecraft 1.11.2 project (Forge based) from Java to Groovy 2.4.11. Since
the generated class files need to be obfuscated to work with Minecraft,
I am using @CompileStatic, as suggested by another Minecraft developer,
so that the Forge obfuscator finds the field/method names in the class
files. This works in some cases, but when trying to access fields of the
base class (e.g. net.minecraft.entity.Entity) I am encountering
groovy.lang.MissingPropertyException|s.
I don't have much experience using @CompileStatic (nor with Minecraft
modding), but looking at the generated class files, it seems as if
property (same for fields) access is not compiled statically, but
remains a call to ScriptBytecodeAdapter.setProperty, with the property
name given as a string literal (ergo the obfuscator won't see it, and
the call in Minecraft will fail). I have explained this more in-depth
with code samples on minecraftforum.net, but did not get a reply (
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2828852-groovy-compilestatic-solution-not-working-when).
Can anyone confirm to me that what I am seeing is the excpected
@CompileStatic behavior - so using @CompileStatic on all Groovy classes
is not the solution to modding Minecraft with Groovy - or if there is
something I can do differently ?
I would also be grateful for any other suggestion at a solution - I
really would like to avoid having to revert the project back to its Java
version :-)
Kind regards,
Ahm