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.开发者_如何学JAVAclient.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?)
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
).
精彩评论