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

Problem when using primitive return type inside a try block

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.0
    • 1.1-beta-1
    • groovy-jdk
    • None
    • Windows XP, Eclipse and Groovy 1.0

    Description

      When a return statement is used inside a try block, the program fails if the return value is a primitive type.

      The following program reproduces the problem:

      class Test {
         int method() {
            try {
               return 1
            }  finally {
               print "Do something"
            }
         }
      	
         static void main(args) {
            new Test().method()
         }
      }
      

      The following error message is generated:

      java.lang.VerifyError: (class: Test, method: method signature: ()I) Expecting to find object/array on stack
      Exception in thread "main"

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            vinigodoy Vinícius Godoy de Mendonça
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: