Question

I am new to CoffeeScript and maybe I am doing something strange, but I get a ClassCastException when I try to compile the following CoffeeScript Code:

if 1 == 1 then
  alert 'Thats always true'

If i write it in the following form:

if 1 == 1 then alert 'Thats always true'

it works... Is there some syntax-error? Even if thats the case I would never expect an internal compiler error if I make any syntax error...

I am using the NetBeans CoffeeScript Plugin. Here is the Exception:

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Double at coffeescript.nb.CoffeeScriptRhinoCompiler.compile(CoffeeScriptRhinoCompiler.java:59) at coffeescript.nb.CoffeeScriptAction$CompilerTask.compile(CoffeeScriptAction.java:236) at coffeescript.nb.CoffeeScriptAction$ConsoleOutputCompileTask.run(CoffeeScriptAction.java:193) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)

Was it helpful?

Solution

You don't use then with block-level code.

if 1 == 1
    alert 'Thats always true'

As for the exception, it must be a bug in the plugin or NetBeans itself. The CoffeeScript compiler correctly shows an "unexpected POST_IF" error.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top