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

The method pointer operator suppresses checked exceptions and results in a MethodMissingException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.12
    • 3.0.18, 4.0.13
    • None
    • None

    Description

      The method pointer operator suppresses checked exceptions and results in a MethodMissingException instead in groovy 4.0.12. This issue seems to first appear in groovy 3.0.16, which is the earliest version I am able to reproduce. Example code

      class Foo {
          static void bar(String str) {
              throw new IOException()
              println str
          }
      }
      def baz = Foo.&bar
      
      baz('hi') 

      This results in a MethodMissingException despite the IO Exception being thrown. This seems to be the case for any checked exception.

       

      class Foo {
          static void bar(String str) {
              throw new IOException()
              println str
          }
      }
      
      Foo.bar("hi") 

      When calling the method directly I get an IO Exception as expected 

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              astrogg Joe Li
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: