Error compiling scripts
LadyCailinBot opened this issue ยท 5 comments
CMDHELPER-3178 - Reported by Murreey
In the process of moving our server over to 1.13.2 from 1.12, and I'm seeing this stacktrace when CommandHelper compiles. Unfortunately I can't tell which code specifically is causing it, and it doesn't give me any information about where it's being thrown. If I try and run any procedures I've defined, the scripts don't run and the error is printed again to console.
[20:57:06 WARN]: java.lang.Error: closure does not properly implement isBranch. It does not return a value with the same count as the actual children. Expected: 0; Actual: 1 [20:57:06 WARN]: at com.laytonsmith.core.MethodScriptCompiler.eliminateDeadCode(MethodScriptCompiler.java:2374) [20:57:06 WARN]: at com.laytonsmith.core.MethodScriptCompiler.eliminateDeadCode(MethodScriptCompiler.java:2409) [20:57:06 WARN]: at com.laytonsmith.core.MethodScriptCompiler.eliminateDeadCode(MethodScriptCompiler.java:2409) [20:57:06 WARN]: at com.laytonsmith.core.MethodScriptCompiler.eliminateDeadCode(MethodScriptCompiler.java:2409) [20:57:06 WARN]: at com.laytonsmith.core.MethodScriptCompiler.eliminateDeadCode(MethodScriptCompiler.java:2409) [20:57:06 WARN]: at com.laytonsmith.core.MethodScriptCompiler.eliminateDeadCode(MethodScriptCompiler.java:2409) [20:57:06 WARN]: at com.laytonsmith.core.MethodScriptCompiler.eliminateDeadCode(MethodScriptCompiler.java:2409) [20:57:06 WARN]: at com.laytonsmith.core.MethodScriptCompiler.compile(MethodScriptCompiler.java:1712) [20:57:06 WARN]: at com.laytonsmith.core.functions.IncludeCache.get(IncludeCache.java:51) [20:57:06 WARN]: at com.laytonsmith.core.MethodScriptCompiler.registerAutoIncludes(MethodScriptCompiler.java:2547) [20:57:06 WARN]: at com.laytonsmith.core.AliasCore.reload(AliasCore.java:406) [20:57:06 WARN]: at com.laytonsmith.commandhelper.CommandHelperPlugin.onCommand(CommandHelperPlugin.java:554) [20:57:06 WARN]: at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) [20:57:06 WARN]: at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:151) [20:57:06 WARN]: at org.bukkit.craftbukkit.v1_13_R2.CraftServer.dispatchCommand(CraftServer.java:734) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.PlayerConnection.handleCommand(PlayerConnection.java:1782) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.PlayerConnection.a(PlayerConnection.java:1590) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.PacketPlayInChat.a(PacketPlayInChat.java:45) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.PacketPlayInChat.a(PacketPlayInChat.java:5) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:15) [20:57:06 WARN]: at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [20:57:06 WARN]: at java.util.concurrent.FutureTask.run(Unknown Source) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.SystemUtils.a(SystemUtils.java:108) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.MinecraftServer.b(MinecraftServer.java:1018) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.DedicatedServer.b(DedicatedServer.java:439) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.MinecraftServer.a(MinecraftServer.java:940) [20:57:06 WARN]: at net.minecraft.server.v1_13_R2.MinecraftServer.run(MinecraftServer.java:837) [20:57:06 WARN]: at java.lang.Thread.run(Unknown Source)
I've not started updating any scripts yet so there's a lot of deprecation warnings, so it could be related to that.
Thanks.
Comment by LadyCailin
Regardless of whether or not this is a bug related to your code, you should never see java stacktraces, so there is action required on my part here. I'll look into this and get back to you.
Comment by LadyCailin
Looking at this further, this is definitely an error on my part, but I don't know how to reproduce it, so I can't fix the underlying problem. However, I have added a code target to the error message, so that we can figure out what code it is that's causing this. Try the latest build. It won't fix the problem, but it should report the location of the code causing it in the stacktrace. I suspect that your code is wrong and needs to be fixed, but there's also a bug with the error reporting in MethodScript, so if you don't mind, report back here with the code that's causing this, so I can fix this the correct way.
Comment by Murreey
Thanks, running the new build and this is the snippet that's causing it:
http_request(
@webhook,
array(
headers: array(),
method: "POST",
params: json_encode(@message),
success: closure()
)
)
Specifically the error's on the line with that empty closure()
.
Comment by LadyCailin
Ok, thanks! I am able to reproduce locally, so I should be able to get this fixed the correct way, that code should work. In the meantime, however, you can change it to closure(){}
and that will fix it. Thanks for the report!