Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8772

Groovy debugger is on the wrong line when exiting a try/catch

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.5.0
    • 3.0.0-alpha-4, 2.5.5
    • Compiler
    • None

    Description

      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. 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 it seems that groovy compiler does not generate line info for the location right after the try block (but stops there in debugger).
       

       

      Attachments

        1. image2.png
          131 kB
          David Pociu
        2. image1.png
          42 kB
          David Pociu
        3. image.png
          43 kB
          David Pociu

        Activity

          People

            paulk Paul King
            dpociu David Pociu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: