The doc's a bit scant....

http://code.google.com/p/google-web-toolkit/source/browse/trunk/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/ClassLiteralHolder.java

But there's actually not much more to it than that.  Class literals are
implemented as references to static fields... those fields have to live
somewhere in the AST, and ClassLiteralHolder is where we stick them.  At
one point I thought about trying to put each class literal into the
class it represented, but then we'd still need somewhere to stick array
types and primitive types.


http://gwt-code-reviews.appspot.com/1375801/diff/1/dev/core/src/com/google/gwt/dev/jjs/impl/ImplementClassLiteralsAsFields.java
File
dev/core/src/com/google/gwt/dev/jjs/impl/ImplementClassLiteralsAsFields.java
(right):

http://gwt-code-reviews.appspot.com/1375801/diff/1/dev/core/src/com/google/gwt/dev/jjs/impl/ImplementClassLiteralsAsFields.java#newcode236
dev/core/src/com/google/gwt/dev/jjs/impl/ImplementClassLiteralsAsFields.java:236:
private JField resolveClassLiteralField(JClassLiteral classLiteral) {
Yes, let me go back and add comments and generated code examples at
various spots.  Will re-ping when I've done so.  If you do a draft
compile, you should get more useful output.  In my tests, I threw in an
Object.getClass().toString() call to force at least some of the fields
to be setup.

Essentially, these are all calls to the static factory methods in our
emulation of java.lang.Class.

http://gwt-code-reviews.appspot.com/1375801/

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to