Groovy
  1. Groovy
  2. GROOVY-4254

Compiler wrongly compiles a ClosureListExpression that results in NoSuchMethodError at runtime

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8-beta-1
    • Fix Version/s: 1.8-beta-1
    • Component/s: class generator
    • Labels:
      None

      Description

      r19740 removed the following constructor from CurriedClosure class

      public CurriedClosure(Closure uncurriedClosure, int i) {
          this(uncurriedClosure, new Object[]{Integer.valueOf(i)});
      }
      

      ACG still calls this non-existent constructor in the bytecode it generates for ClosureListExpression and the compiled code results in the following error at runtime

      java.lang.NoSuchMethodError: org.codehaus.groovy.runtime.CurriedClosure.<init>(Lgroovy/lang/Closure;I)V
      

      Here is the test to reproduce it:

      import org.codehaus.groovy.runtime.CurriedClosure
      
      class GroovyXXXXBug extends GroovyTestCase {
          void testClosureListExpressionUsage() {
              def clList = (1;2)
              assert clList[0] instanceof CurriedClosure
              assert clList[1] instanceof CurriedClosure
          }
      }
      

        Activity

        Roshan Dawrani created issue -
        Roshan Dawrani made changes -
        Field Original Value New Value
        Assignee Jochen Theodorou [ blackdrag ] Roshan Dawrani [ roshandawrani ]
        Roshan Dawrani made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 1.8-beta-1 [ 16013 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Paul King made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12733197 ] Default workflow, editable Closed status [ 12744980 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12970800 ] Default workflow, editable Closed status [ 12978590 ]

          People

          • Assignee:
            Roshan Dawrani
            Reporter:
            Roshan Dawrani
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development