Here are some tips on how to debug what is happening on the transition from groovy source code into the generated bytecode.
|source (hello.groovy)||- GroovyLexer ->||antlr tokens|
|antlr tokens||- GroovyRecognizer ->||antlr ast |
|antlr ast||- AntlrParserPlugin ->||groovy ast |
|groovy ast||- AsmClassGenerator->||bytecode (hello.class)|
Note3 AntlrParserPlugin source available.
For these examples let's assume the file Hello.groovy contains
GroovyLexer (viewing Antlr Tokens)
To view the antlr tokens that the source code has been broken into you need to do the following in groovy-core subdirectory
GroovyRecognizer (viewing Antlr AST)
To view the antlr AST that the recognized tokens have built
AntlrParserPlugin (viewing Groovy AST)
To view the Groovy AST that is one step closer to the generated bytecode you can generate Hello.groovy.xml using these unix commands.
This can be generated using both classic and jsr parsers, by changing the groovy.jsr system property. By doing this we can diff the generated Groovy AST artifacts for debugging and migration purposes.
Decompiling bytecode back to Java