Is it possible to s开发者_如何学编程ee the statements of Groovy script as it executes, like the output of running bash with -v or -ex? What would it take to do this programmatically?
Is it possible to see the statements of Groovy script as it executes, like the output of running bash with -v or -ex?
I suppose it's possible, but I'm not aware of any tool that does this.
This could be done relatively easily using a global AST transformation whose public void visit(ASTNode[] astNodes, SourceUnit sourceUnit)
method adds println Statement
s after or before each Statement
visted in a class.
See http://groovy.codehaus.org/Global+AST+Transformations for more details.
精彩评论