2011/3/15 Scott Blum <[email protected]>: > 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..
It seems to work fine in simple cases in web mode. >> 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. Yes, after taking more closer look at GenerateJavaScriptAST code I found the logic I was interested in. The problem I described above (broken polymorphic calls) was caused by superClass field being equal to null for nodes representing interfaces. That would lead to broken overrides calculations for an interface containing method called toString (that overrides one from java.lang.Object) and thus to broken JS output. That was fairly non-trivial to find because you need toString being called through an interface to trigger that behaviour. Now, I'm wondering if it wouldn't make sense to have an assertion in some place checking that whether interfaces have java.lang.Object as their superClass as it seems to be invariant for GWT. >> >> 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. Thanks for pointer to JJSTestBase that will be useful for me, too. -- Grzegorz Kossakowski -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
