tags:

views:

38

answers:

1

Sometimes I'd like to take a peek into the implementation of the JRE classes, which is used to generate the JavaScript code.

For some classes, I can find a corresponding implementation by guessing its name, e.g. com.google.gwt.core.client.impl.StringBuilderImpl. But where's the implementation for java.util.Date for example? Where do I find it, and how does GWT find it (via some configuration file?)

+1  A: 

Where do I find it

A quick find on GWT trunk reveals user.super.com.google.gwt.emul.java.util.Date.java and user.super.com.google.gwt.emul.java.sql.Date.java. The user.super.com.google.gwt.emul package holds more emulated Java classes.

how does GWT find it (via some configuration file?)

The module XML file has the <super-source/> directive which tells the compiler where to find the source, relative to the module root. I'm assuming here that no parameters means that the user.super.com.google.gwt.emul becomes the "root" and thus user.super.com.google.gwt.emul.java.util.Date.java becomes java.util.Date.java (notice for example that the package specified in that emulated Data.java is not user.super.com.google.gwt.emul.java.util but java.util).

Igor Klimer
Perfect, thanks. The reason I didn't find it: Eclipse shows the packages under com.google.gwt.emul as empty (in gwt-user.jar)! However, when I unjar it, the package is filled with java sources - it's all there. I think I know, why Eclipse doesn't show them: The package statement doesn't match the path in the jar. But now I know where they are, thanks for your help!
Chris Lercher