[
https://issues.apache.org/jira/browse/GROOVY-8385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16285008#comment-16285008
]
mgroovy commented on GROOVY-8385:
---------------------------------
@[~blackdrag] (dev mailing list reply): Trying to access the field directly
using
{code}
entity.@hurtResistantTime = 0
{code}
throws
{code}
groovy.lang.MissingFieldException: No such field: hurtResistantTime for class:
net.minecraft.entity.passive.EntityCow
at groovy.lang.MetaClassImpl.setAttribute(MetaClassImpl.java:2887)
at groovy.lang.MetaClassImpl.setAttribute(MetaClassImpl.java:3808)
at
org.codehaus.groovy.runtime.InvokerHelper.setAttribute(InvokerHelper.java:179)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setField(ScriptBytecodeAdapter.java:345)
at
com.elfmega.battleball.EntityFallingEnchantedBlock.attackEntity(EntityFallingEnchantedBlock.groovy:518)
at
com.elfmega.battleball.EntityFallingEnchantedBlock.func_70071_h_(EntityFallingEnchantedBlock.groovy:216)
at net.minecraft.world.World.func_72866_a(World.java:1965)
at net.minecraft.world.WorldServer.func_72866_a(WorldServer.java:840)
at net.minecraft.world.World.func_72870_g(World.java:1934)
at net.minecraft.world.World.func_72939_s(World.java:1748)
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:621)
at
net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:720)
at
net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:624)
at
net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:149)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)
at java.lang.Thread.run(Thread.java:745)
{code}
during Minecraft startup.
> CompileStatic: Improved method call/property access Java compatibility for
> Minecraft Forge obfuscation support
> --------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-8385
> URL: https://issues.apache.org/jira/browse/GROOVY-8385
> Project: Groovy
> Issue Type: Improvement
> Components: bytecode
> Reporter: mgroovy
> Priority: Minor
> Labels: Forge, Java, JavaCompatibility, Minecraft, Modding
>
> * Even with @CompileStatic the Groovy compiler creates bytecode for method
> calls / property access which is dynamic in nature.
> * This means that e.g. Minecraft Forge's obfuscator does not pick up the
> calls in the generated bytecode, which means they do not get obfuscated,
> which in turn makes the code fail when executed in Minecraft.
> * This effectively makes it nearly impossible to write Minecraft mods with
> Groovy, which in turn is a wasted opportunity to get people involved with
> Groovy early on.
> * Possible approaches to improve the situation:
> ## Improve on a fundamental level: According to [~paulk] only a few calls are
> required to be done dynamically for Groovy functionality to work as expected
> under @CompileStatic.
> *** The problem seems to be that it could be hard to be a 100% sure no edge
> case is overlooked, as to not break @CompileStatic in situations where e.g.
> no 100% Java-call-compatibility is needed.
> ## Improve through newly introduced @CompileStatic parameters
> *** => Static method call / property access bytecode is generated for method
> code / all class methods repectively (with possible exceptions for the know
> cases mentioned above).
> ## Improve through newly introduced @ObfuscationJavaCompatibility annotation
> that can be put on a method or class
> *** behavior same as for @CompileStatic parameters above
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)