Sunday, November 04, 2007

GWT and its package names

Recently I and my friend came across a silly bug that took nearly half a day for us to find a solution for it. The bug that i encountered is with the GWTCompiler.

We had some compilation problems when we started writing an Async interface for one of our services. The error log said that the Proxy class that was generated by GWT for deferred binding had some errors.
It pointed out at some line and read com.google was not resolved. But the snapshot of the file was pretty clean and had no errors.
At first i thought it was some classpath problem, but after fighting and struggling with it for about 2 hours or so my friend suddenly popped up with a doubt, eyeing at the Async interface's method which had a parameter named com.

That's it; it is not able to resolve packages, if there is any variable declared with same name as the package.

For example

//imports
public interface MyServiceAsync{
public void save(SomeType com, CallBack c);
}

This Async interface will produce errors while compiling. So make sure that you don't name the variables with any package names.

No comments: