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

Have @Deletgate include line number in stack traces

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.2.2
    • None
    • None

    Description

      I was experimenting with @Delegate and noticed that if the underlying class throws an exception, the delegating class has no line number.

      Would be a nice enhancement to have the stack trace reference the line where the delegation was declared.

      See attached example script which should show this output:

      Foo!
      Caught: java.lang.Exception: blow up with bar
      java.lang.Exception: blow up with bar
      	at Lower.blowup(delegatetest.groovy:15)
      	at Lower$blowup.call(Unknown Source)
      	at Upper.blowup(delegatetest.groovy)      # no line number here
      	at Upper$blowup.call(Unknown Source)
      	at delegatetest.run(delegatetest.groovy:25)
      

      Attachments

        1. delegatetest.groovy
          0.3 kB
          Mat Schaffer

        Activity

          People

            melix Cédric Champeau
            matschaffer Mat Schaffer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: