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

Verifyerror in static compiled code

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.6, 2.2.0-beta-1
    • Fix Version/s: 2.1.7, 2.2.0-beta-2
    • Component/s: Static compilation
    • Labels:
      None

      Description

      The following program is a test for GROOVY-5883:

                  @groovy.transform.CompileStatic
                  class Test<T> {
                      def map(Closure<T> mapper) { 1 }
                      def m1(Closure<Boolean> predicate) {
                          map { T it -> return predicate(it) ? it : null }
                      }
                      def m2(Closure<Boolean> predicate) {
                          map { T it -> return predicate(it) ? it : (T) null }
                      }
                      def m3(Closure<Boolean> predicate) {
                          Closure<T> c = { T it -> return predicate(it) ? it : null }
                          map(c)
                      }
                  }
                  def t = new Test<String>()
                  assert t.m1{true} == 1
                  assert t.m2{true} == 1
                  assert t.m3{true} == 1
      

      This fails to execute in static compilation mode only with a VerifyError in the generated Closure#doCall methods in any of m1/m2/m3.created

        Attachments

          Activity

            People

            • Assignee:
              blackdrag Jochen Theodorou
              Reporter:
              blackdrag Jochen Theodorou
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: