groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <>
Subject Re: Line numbers and debugging in method when branching
Date Thu, 25 Aug 2016 05:49:01 GMT
On 24.08.2016 23:10, Winnebeck, Jason wrote:
> Consider the following class:
> *class *Debugging {
> *public static void *main(String[] args) {
> *a*: *if *(args.*length *> 0) {
> *b*: println *"args"
> *}
> }
> }
> And let’s say that I run the program with no arguments, and I put
> IntelliJ debugger to break on line a. Now when I “step next” I see it
> highlight line b, then step next and the program ends. The line b
> clearly did not run. Is this a problem with IntelliJ or the bytecode?
> Below is the bytecode for the method. I’m assuming the issue is that L2
> is before the return, and at the return bytecode we see before it
> LINENUMBER 4. If the return was annotated with a linenumber 5 or 6, I
> assume the debugger would step to the closing brace of the if statement
> (or of the method itself, depending on what was preferred). Is this an
> issue with the IntelliJ debugger, or is it really a limitation of the
> Groovy bytecode generation?

comparing with Java the last return should be annotated with the line 
with the closing brace of the method

> A workaround is if I put an empty return
> statement at the end of main, the debugger works, but strangely in
> bytecode I see two returns.

that now is kind of a limitation of our bytecode generation

bye Jochen

View raw message