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

Static Type Checker: Exception type not inferred for catch blocks

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-rc-3
    • 2.0-rc-4
    • Static Type Checker
    • None

    Description

      The following code:

      import groovy.transform.CompileStatic
      
      @CompileStatic
      File foo() {
         try {
         
         } catch(e) {
             handleError(e)
         }
      }
      
      def handleError(Throwable e) {
        println e.message
      }
      

      Fails to compile with:

      [Static type checking] - Cannot find matching method ConsoleScript2#handleError(java.lang.Object)
       at line: 8, column: 8
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            graemerocher Graeme Rocher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: