views:

827

answers:

2

Basically I can't even import Groovy classes in a regular GWT EntryPoint:

import com.google.gwt.core.client.EntryPoint; // OK
import groovy.lang.Binding; // NOT OK
import groovy.util.GroovyScriptEngine; // NOT OK

Intellij 8.0's inspector keeps telling me this:

Class 'groovy.lang.Binding' is not present in JRE Emulation Library so it cannot be used in client code

Class 'groovy.util.GroovyScriptEngine' is not present in JRE Emulation Library so it cannot be used in client code

Obviously I end up having problems at runtime as well:

[ERROR] Line 11: No source code is available for type groovy.util.GroovyScriptEngine; did you forget to inherit a required module?

[ERROR] Line 12: No source code is available for type groovy.lang.Binding; did you forget to inherit a required module?

I've checked several times my module's dependencies, and groovy-all-1.6.1.jar is correctly defined in there. I'm probably missing something elsewhere...

Any idea?

+2  A: 

Attempting to use Groovy makes no sense as the Gwt compiler only understands the Java language syntax along it it's subset of Java libraries. The compiler works on source not byte code. One reason includes the magic comments necessary to stash javascript (JSNI). The compiler is actually scanning the source path for *.java not *.class files.

Read the doco fir a more in depth understanding.

mP
Thanks, I didn't know that. I hope GWT will support Groovy code in the future. Cheers.
Tiago Fernandez
+1  A: 

In some sense it would be pretty cool to have a groovy language gwt.

But then why go from one dynamic language to another? The point of gwt I thought was to get static typing and easy debugging of java.

k s