Generators don't work good with refresh button

0 views
Skip to first unread message

Alen Vrečko

unread,
Jul 21, 2009, 8:30:59 AM7/21/09
to Google Web Toolkit, bst...@google.com
Hi.

The generators are without a doubt a remarkable feature of gwt. But if
you use any reflection on the client classes in the generator you lose
refresh button support. Furthermore while not that major I do find it
annoying that refreshing doesn't recompile the generator code. You
have to stop the hosted mode and start again.

It all boils down to the fact that client code is loaded in
ComplingClassLoader and the Generator is loaded in a different
ClassLoader than that.

Reflection is not that nice. But sometimes one has perfectly
legitimate use cases to use reflection. A good example is Google-Gin.

It came up here http://groups.google.com/group/google-gin/browse_thread/thread/d383babb48a287bb
.

Basically gin is instantiating the gin modules which are client code.
If you change the module refresh doesn't work since gin generator is
still seeing the original module loaded and not the recompiled.

I've partially solved the issue (renaming modules doesn't work) by
hacking into the byte[] definitions for the newly created code. Like
this http://pastie.org/553279 .

I guess JavaRebel could be used or something like that. But I'd like
to see a pure gwt solution to this.

I've been thinking in the lines of compiling the generators and
putting the generators in a child of CompilingClassLoader. In that
case using reflection in the generators should get the latest class
definitions. Also changing generator code and pressing refresh would
work.

What do you guys think?

Cheers
Alen

Thomas Broyer

unread,
Jul 21, 2009, 10:11:24 AM7/21/09
to Google Web Toolkit


On 21 juil, 14:30, Alen Vrečko <alen_vre...@yahoo.com> wrote:
> Hi.
>
> The generators are without a doubt a remarkable feature of gwt. But if
> you use any reflection on the client classes in the generator you lose
> refresh button support. Furthermore while not that major I do find it
> annoying that refreshing doesn't recompile the generator code. You
> have to stop the hosted mode and start again.
>
> It all boils down to the fact that client code is loaded in
> ComplingClassLoader and the Generator is loaded in a different
> ClassLoader than that.
>
> Reflection is not that nice. But sometimes one has perfectly
> legitimate use cases to use reflection. A good example is Google-Gin.
[...]
> What do you guys think?

...that you should have used (or at least cc'd) the GWT-C group ;-)

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

Alen Vrecko

unread,
Jul 22, 2009, 6:18:47 AM7/22/09
to Google Web Toolkit
Thanks. Good idea. I could have learned by now that there is usually
user and dev lists... Will repost there.

Cheers
Alen

Juraj Vitko

unread,
Jul 22, 2009, 12:31:27 PM7/22/09
to Google Web Toolkit
Hi Alen,
I'm new in GWT, but I successfully use my own source code generation
tools to handle dynamic things on the client in a static way.
I'm not sure how exactly the JTypeOracle stuff works, but I like to be
able to see and/or debug through the generated code, plus there's no
extra ClassLoading involved - the generated stuff is 1st class GWT
objects.
J.
Reply all
Reply to author
Forward
0 new messages