Thanks Jochen, I created https://issues.apache.org/jira/browse/GROOVY-7918 for 
this issue.

Jason

-----Original Message-----
From: Jochen Theodorou [mailto:[email protected]] 
Sent: Thursday, August 25, 2016 1:49 AM
To: [email protected]
Subject: Re: Line numbers and debugging in method when branching

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


This email message and any attachments are for the sole use of the intended 
recipient(s). Any unauthorized review, use, disclosure or distribution is 
prohibited. If you are not the intended recipient, please contact the sender by 
reply email and destroy all copies of the original message and any attachments.

Reply via email to