You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "David Pociu (JIRA)" <ji...@apache.org> on 2018/09/03 19:59:00 UTC

[jira] [Created] (GROOVY-8772) Groovy debugger is on the wrong line when exiting a try/catch

David Pociu created GROOVY-8772:
-----------------------------------

             Summary: Groovy debugger is on the wrong line when exiting a try/catch
                 Key: GROOVY-8772
                 URL: https://issues.apache.org/jira/browse/GROOVY-8772
             Project: Groovy
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 2.5.0
            Reporter: David Pociu
         Attachments: image.png, image1.png, image2.png

Complete report also filed with IntelliJ Idea at [https://youtrack.jetbrains.com/issue/IDEA-198280]

In the following code snippet:


----
{{package aaa}}

{{/**}}
{{ * Created by D. Pociu - InsiTech on 9/3/2018.}}
{{ */}}
{{class Main1 {}}

{{ static void main(String[] args){}}
{{ println "Hello"}}
{{ try{}}
{{ int a = 123;}}

{{ } catch (Exception ex){}}
{{ String s = ex.getMessage()}}
{{ println s}}
{{ }}}

{{ println "what just happened?"}}
{{ }}}


{{}}}
----
If we set a debug point at the 'println "Hello" line and go inside the try/catch using the debugger, the next line after 'int a = 123' that the debugger stops on should be 'println "what just happened?"' , but instead is 'println s'.

So the debugger jumps to the last line of the catch (visually, not any of the variables, or anything) , when visually it should be at the first line after the catch if no exception has been thrown.

This creates GREAT confusion when I'm trying to debug complex classes because it gives the impression that the catch clause has been triggered when it has not.
See attached screenshots of the step by step:
----
Here's what the guys at Jetbrains had to say (see link above also):
 
_Peter Gromov  commented 6 hours ago_
_Yes. The same problem is reproducible in Eclipse, so [David P.|https://youtrack.jetbrains.com/users/dpociu] could you please report the issue to Groovy compiler team? See [http://groovy-lang.org/reporting-issues.html]_
 __ 
_Egor Ushakov  commented 7 hours ago_
_[Peter Gromov|https://youtrack.jetbrains.com/users/peter] it seems that groovy compiler does not generate line info for the location right after the try block (but stops there in debugger)._
 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)