[how to] I want to invoke Generator.generate

26 views
Skip to first unread message

Alex Dobjanschi

unread,
Aug 28, 2011, 6:10:01 AM8/28/11
to google-we...@googlegroups.com
Hi guys,
like the subject states, for testing purposes I want to create and compile new classes at runtime, using generators (similar to what deferred binding does, only programmatic).

I have an instance of a generator (doesn't matter which one), and I want to invoke <code>generate(...)</code. Has anybody done it? It turns out, even the simplest generator needs a lot of dependencies (like a TreeLogger, GeneratorContext which in fact depends on a TypeOracle, ResourceOracle, etc etc etc).

So, how to I bypass those dependencies? Is there a project that addresses this?
Regards,
Alex.

Thomas Broyer

unread,
Aug 28, 2011, 6:23:07 AM8/28/11
to google-we...@googlegroups.com
AFAIK, GWT tests themselves use GWTTestCase to actually test the generated code (rather than the generator). For generators built around a "model" though (editor, requestfactory, PlaceHistoryMapper), some of them use a "synthetic" TypeOracle and a special TreeLogger; the only test the "model" part (not the "generator" one) so they don't need a ResourceOracle or GeneratorContext.
In other words, you'd better look in the SVN repo (in trunk/user/test) how GWT tests its own generators (focusing on the most recent ones)

Alex Dobjanschi

unread,
Aug 28, 2011, 6:40:49 AM8/28/11
to google-we...@googlegroups.com
Thanks Thomas, I'll have a look.
But, I'm not interested in "how GWT tests its own generators". Anyway I think you got my point.
Alex.
Reply all
Reply to author
Forward
0 new messages