On Mon, Mar 14, 2011 at 4:41 PM, Grzegorz Kossakowski <
[email protected]> wrote:

> So, if my GWT app doesn't have any generators exact contents of
> TypeOracle doesn't matter? I'm asking because I'm thinking of creating
> some stub data structures for jribble units and just move on to fixing
> some other issues and come back only once I want to support Generators
> written in Scala or Generators referring Scala.
>

That *may* be true but you'd have to try it and find out.  I know we use
TypeOracle for a couple of other purposes in dev mode, but I don't *think*
we use it for anything else in web mode..


> > 2) The GWT AST, which is essentially a source-level representation of the
> > user's Java code, including method bodies, which is optimized and
> translated
> > into JavaScript.  May be referred to as GWTC, the compiler, the web-mode
> > compiler, etc.  Mostly lives in com.google.gwt.dev.jjs (which stands for
> > 'Java to JavaScript').  TypeMap is a small implementation detail that's
> only
> > useful for the JDT AST -> GWT AST translation.
>
> I see. It happens that TypeMap is quite interesting from my point of
> view because I'm translating Jribble AST to GWT AST by following JDT
> AST -> GWT AST translation (more or less).
>

Eek... to be honest, JDT AST -> GWT AST is some of the nastiest code around,
mostly due to JDT.  If you're going to follow a pattern, you might look at
the new GwtAstBuilder, which is at least marginally cleaner than
BuildTypeMap/GenerateJavaAST.


> Is there one class that is dealing specifically with emulating object
> orientation or it's scattered around many classes? I'm asking because
> toString() call get's translated to toString_2() javascript call and
> this method is not being defined anywhere in js source code. I'm
> trying to pinpoint location where this stuff is handled to understand
> why I get a call to non-existing place.
>

Hmm, I'm not completely sure what you're asking.  GenerateJavaScriptAST is
the place to look for how precisely the Java AST is transformed into
JavaScript.


> I've got another question. Do you have any tool for checking
> correctness of GWT's ASTs or a tool that allows one to dump ASTs and
> compare them? The scenario I have in mind is like this:
> 1. I have minimal jribble example that exhibits some obscure problem
> like with toString described above and I fail to find a bug but I
> suspect that GWT ASTs I get out of Jribble are broken.
> 2. I prepare corresponding Java code that imitate code from jribble.
> This should work (or I found a bug in gwtc itself but this is highly
> unlikely). Now I'd like to compare those two ASTs. Such comparison
> should immediately reveal the source of my problems.
>

You can always call toSource() on any GWT AST node to get the source
representation.  GwtAstBuilderTest utilizes this to verify that the new
GwtAstBuilder is mostly source-compatible with the old translator.  We also
have a bunch of unit tests derived from JJSTestBase that all generally
verify that a certain input source + certain transformations turns into
expected output.

Other that that, we use JUnit / GWTTestCase to actually execute the compiled
output and verify correctness JUnit style.

Scott



>
> Do you have anything handy that would help me with this or do you have
> some other idea how to solve my problem?
>
> --
> Best regards,
> Grzegorz Kossakowski
>

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

Reply via email to