Debug/view source of GWT generated java code

2020-03-26 04:32发布

What are my options for being able to view the generated code from my custom GWT generator (com.google.gwt.core.ext.Generator).

I have been compleplating creating my own source writer that prints out the source in system.out etc, which I have managed to do but it all seems very hard and not very easy to use.

Sometimes I just break the generated code on purpose so that the broken file is printed out in the temp folder, works quite well.

There must be a better way...I'm sure I'm missing something.

2条回答
疯言疯语
2楼-- · 2020-03-26 04:38

To write the generated Java source (i.e. not the generated JavaScript) into a directory when you run the GWT-Compiler, simply add the gwtc compiler option "-gen", with a target directory.

查看更多
够拽才男人
3楼-- · 2020-03-26 04:43

Alternate option is to debug the GWT compilation process which actually calls your generator's generate() method. You can setup a breakpoint at the beginning of your generate() method, and then step through it and inspect what's going on.

For further information on how to do it, you can look into the following:

http://lazyrhino.blogspot.de/2013/10/gwt-generator-part-3-debugging-generation.html

查看更多
登录 后发表回答