调试/查看 GWT 生成的 java 代码的源代码
我可以选择哪些选项来查看自定义 GWT 生成器 (com.google.gwt.core.ext.Generator) 生成的代码。
我一直在完成创建自己的源代码编写器,打印出 system.out 等中的源代码,我已经设法做到了,但这一切似乎都非常困难并且不太容易使用。
有时我只是故意破坏生成的代码,以便将损坏的文件打印在临时文件夹中,效果很好。
一定有更好的方法...我确信我错过了一些东西。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要在运行 GWT-Compiler 时将生成的 Java 源代码(即不是生成的 JavaScript)写入目录,只需添加 gwtc 编译器选项“-gen”,带有目标目录。
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.
另一种选择是调试 GWT 编译过程,该过程实际上调用生成器的generate() 方法。您可以在generate()方法的开头设置一个断点,然后单步执行它并检查发生了什么。
有关如何执行此操作的更多信息,您可以查看以下内容:
http://lazyrhino.blogspot.de/2013/10/gwt-generator-part-3-debugging- Generation.html
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