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

VerifyError with implicit call() on closure field with @CompileStatic

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.2.2
    • Component/s: Static compilation
    • Labels:
      None

      Description

      The following test case illustrates the issue, which only occurs if there are more than one argument to the call:

      package org.codehaus.groovy.classgen.asm.sc.bugs
      
      import groovy.transform.stc.StaticTypeCheckingTestCase
      import org.codehaus.groovy.classgen.asm.sc.StaticCompilationTestSupport
      
      @Mixin(StaticCompilationTestSupport)
      class GroovyVerifyErrorBug extends StaticTypeCheckingTestCase {
      
          @Override
          protected void setUp() {
              super.setUp()
              extraSetup()
          }
      
          void testShouldNotThrowVerifyErrorIfUsingImplicitCall() {
              assertScript '''
      class Foo {
          Closure isUpper = { String it, String up -> it.toUpperCase() == up }
      
          def test(String str) {
              isUpper(str, 'ABC') // replace with isUpper.call(str,'ABC') and no error
          }
      }
      def foo = new Foo()
      assert foo.test('abc')
      '''
          }
      }
      
      

      Using .call doesn't throw any VerifyError.

        Attachments

          Activity

            People

            • Assignee:
              melix Cédric Champeau
              Reporter:
              melix Cédric Champeau
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: