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

SAM trait coercion with default parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.10
    • 3.0.11, 4.0.2, 2.5.19
    • None

    Description

      trait T {
          abstract def foo(a, b = 1)
      }
      
      T t = { o1, o2 ->
          println o1
          assert o2 == 1
      }
      t.foo(42) // Caught: groovy.lang.MissingMethodException: No signature of method: abstractMethod$_run_closure1.doCall() is applicable for argument types: (java.lang.Integer) values: [42]
      

      Expected result: it should just work or throw GroovyCastException in case of traits are not SAM candidates

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              daniilo Daniil Ovchinnikov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: