groovy
  1. groovy
  2. GROOVY-2792

Unwanted InvokerInvocationException

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.6-beta-1
    • Fix Version/s: 1.6-rc-1
    • Component/s: None
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      Both tests in the appended code fails with an uncaught exception under 1.6.

      class G16BugTest extends GroovyTestCase {
          void testAssert() {
              try {
                  new G16BugHelper().check()
              } catch (AssertionError e) {
                  // ignore
              }
          }
      
          void testCopy() {
              def inst = new Copy()
              inst.sourceDir = '/Users/hans/tmp/garbage/d1/' as File
              inst.targetDir = '/Users/hans/tmp/garbage/d2/' as File
              inst.execute()
          }
      }
      
      class G16BugHelper {
          void check() {
              assert 0 > 1
          }
      }
      
      class Copy {
          File sourceDir
          File targetDir
      
          void execute() {
             AntBuilder ant = new AntBuilder()
              ant.copy(todir: targetDir) {
                  fileset(dir: sourceDir)
              }
          }
      }
      

      testAssert fails with:

      org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.AssertionError: Expression: (0 > 1)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:743)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:769)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:749)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:160)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(ScriptBytecodeAdapter.java:185)
      	at G16BugTest.testAssert(G16BugTest.groovy:6)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
      Caused by: java.lang.AssertionError: Expression: (0 > 1)
      	at org.codehaus.groovy.runtime.InvokerHelper.assertFailed(InvokerHelper.java:372)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.assertFailed(ScriptBytecodeAdapter.java:642)
      	at G16BugHelper.check(G16BugTest.groovy:22)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
      	... 26 more
      

      testCopy fails with

      org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: Copy.fileset() is applicable for argument types: (java.util.LinkedHashMap) values: {[dir:/Users/hans/tmp/garbage/d1]}
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:743)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:769)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:749)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:160)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(ScriptBytecodeAdapter.java:185)
      	at G16BugTest.testCopy(G16BugTest.groovy:16)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
      Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: Copy.fileset() is applicable for argument types: (java.util.LinkedHashMap) values: {[dir:/Users/hans/tmp/garbage/d1]}
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:248)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:743)
      	at groovy.lang.Closure.call(Closure.java:292)
      	at groovy.lang.Closure.call(Closure.java:287)
      	at groovy.util.BuilderSupport.doInvokeMethod(BuilderSupport.java:148)
      	at groovy.util.AntBuilder.doInvokeMethod(AntBuilder.java:149)
      	at groovy.util.BuilderSupport.invokeMethod(BuilderSupport.java:64)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:775)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:749)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:160)
      	at Copy.execute(G16BugTest.groovy:33)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
      	... 26 more
      Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: Copy.fileset() is applicable for argument types: (java.util.LinkedHashMap) values: {[dir:/Users/hans/tmp/garbage/d1]}
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:248)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:76)
      	at Copy$_execute_closure1.doCall(G16BugTest.groovy)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
      	... 43 more
      Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: Copy.fileset() is applicable for argument types: (java.util.LinkedHashMap) values: {[dir:/Users/hans/tmp/garbage/d1]}
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:743)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:757)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:745)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:160)
      	at Copy.invokeMethod(G16BugTest.groovy)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:371)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:322)
      	at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:76)
      	at Copy$_execute_closure1.doCall(G16BugTest.groovy:34)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
      	... 52 more
      Caused by: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: Copy.fileset() is applicable for argument types: (java.util.LinkedHashMap) values: {[dir:/Users/hans/tmp/garbage/d1]}
      

        Activity

        Hide
        blackdrag blackdrag added a comment -

        I cannot reproduce this with trunk. Both, 1.6 and 1.5.x are doing fine

        Show
        blackdrag blackdrag added a comment - I cannot reproduce this with trunk. Both, 1.6 and 1.5.x are doing fine
        Show
        Hans Dockter added a comment - I have tried: http://teamcity.jetbrains.com/guestAuth/repository/download/bt109/.lastSuccessful/groovy-all-1.6-beta-1-SNAPSHOT.jar
        Hide
        blackdrag blackdrag added a comment -

        could you please try again with a fresh build from svn?

        Show
        blackdrag blackdrag added a comment - could you please try again with a fresh build from svn?
        Hide
        Hans Dockter added a comment -

        I've done a fresh build from svn. If I run the unit test with groovy G16BugTest it works.

        If I run it like this (from the classes dir with G16BugTest) I get the exceptions from above:

        java -cp .:/yourpath/groovy-all-1.6-beta-1-SNAPSHOT.jar:/yourpath/junit-4.4.jar:/yourpath/ant-1.7.0.jar::/yourpath/ant-launcher-1.7.0.jar G16BugTest
        

        I've added a main method for this to the G16BugTest

        import junit.textui.TestRunner
        
        class G16BugTest extends GroovyTestCase {
            void testAssert() {
                try {
                    new G16BugHelper().check()
                } catch (AssertionError e) {
                    // ignore
                }
            }
        
            void testCopy() {
                def inst = new Copy()
                inst.sourceDir = '/Users/hans/tmp/garbage/d1/' as File
                inst.targetDir = '/Users/hans/tmp/garbage/d2/' as File
                inst.execute()
            }
        
            static void main(String[] args) {
                TestRunner.run(G16BugTest)
            }
        }
        
        class G16BugHelper {
            void check() {
                assert 0 > 1
            }
        }
        
        class Copy {
            File sourceDir
            File targetDir
        
            void execute() {
                AntBuilder ant = new AntBuilder()
                ant.copy(todir: targetDir) {
                    fileset(dir: sourceDir)
                }
            }
        }
        
        Show
        Hans Dockter added a comment - I've done a fresh build from svn. If I run the unit test with groovy G16BugTest it works. If I run it like this (from the classes dir with G16BugTest) I get the exceptions from above: java -cp .:/yourpath/groovy-all-1.6-beta-1-SNAPSHOT.jar:/yourpath/junit-4.4.jar:/yourpath/ant-1.7.0.jar::/yourpath/ant-launcher-1.7.0.jar G16BugTest I've added a main method for this to the G16BugTest import junit.textui.TestRunner class G16BugTest extends GroovyTestCase { void testAssert() { try { new G16BugHelper().check() } catch (AssertionError e) { // ignore } } void testCopy() { def inst = new Copy() inst.sourceDir = '/Users/hans/tmp/garbage/d1/' as File inst.targetDir = '/Users/hans/tmp/garbage/d2/' as File inst.execute() } static void main( String [] args) { TestRunner.run(G16BugTest) } } class G16BugHelper { void check() { assert 0 > 1 } } class Copy { File sourceDir File targetDir void execute() { AntBuilder ant = new AntBuilder() ant.copy(todir: targetDir) { fileset(dir: sourceDir) } } }
        Hide
        blackdrag blackdrag added a comment -

        Hans, I can still not reproduce the problem. I checked out 1.6, compiled it, then compiled your sample code here. I then used the command line you gave me to execute that code... And it works. None of the tests is failing. Especially puzzling for me is that "Caused by: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: Copy.fileset() is applicable for argument types:". I don't get this kind of exception. If I change fileset to something wrong, to provoke a MissingMethodException, then ant complains before such an exception could even be thrown. The resulting trace contains no Groovy exception. I tried to get something comparable by adding a nonexisting method and such... to no avail.

        Show
        blackdrag blackdrag added a comment - Hans, I can still not reproduce the problem. I checked out 1.6, compiled it, then compiled your sample code here. I then used the command line you gave me to execute that code... And it works. None of the tests is failing. Especially puzzling for me is that "Caused by: org.codehaus.groovy.runtime.metaclass.MissingMethodExceptionNoStack: No signature of method: Copy.fileset() is applicable for argument types:". I don't get this kind of exception. If I change fileset to something wrong, to provoke a MissingMethodException, then ant complains before such an exception could even be thrown. The resulting trace contains no Groovy exception. I tried to get something comparable by adding a nonexisting method and such... to no avail.
        Hide
        Hans Dockter added a comment -

        I'm sure something is wrong. In particular as it does not just happen on my machine but also on teamcity. Have a look at the testoutput of a Gradle test with groovy-1.6.

        http://teamcity.jetbrains.com/guestAuth/repository/download/bt117/10609:id/TEST-org.gradle.api.tasks.util.CopyInstructionTest.xml

        It is exactly the same problem.

        Gradle is started via java and uses groovy-all.

        I don't know how I can further help you to reproduce the bug. We might ask for help on the dev list. It would be cool if someone else could reproduce this bug.

        Show
        Hans Dockter added a comment - I'm sure something is wrong. In particular as it does not just happen on my machine but also on teamcity. Have a look at the testoutput of a Gradle test with groovy-1.6. http://teamcity.jetbrains.com/guestAuth/repository/download/bt117/10609:id/TEST-org.gradle.api.tasks.util.CopyInstructionTest.xml It is exactly the same problem. Gradle is started via java and uses groovy-all. I don't know how I can further help you to reproduce the bug. We might ask for help on the dev list. It would be cool if someone else could reproduce this bug.
        Hide
        blackdrag blackdrag added a comment -

        there was a broken version of trunk for a while last week. The only thing I can imagine is that no actual version of trunk is used for your tests.

        Show
        blackdrag blackdrag added a comment - there was a broken version of trunk for a while last week. The only thing I can imagine is that no actual version of trunk is used for your tests.
        Hide
        Hans Dockter added a comment -

        I think this is unlikely. I've done a fresh checkout and a new build. My teamcity build is also using a groovy-jar of a Groovy build from this morning.

        Show
        Hans Dockter added a comment - I think this is unlikely. I've done a fresh checkout and a new build. My teamcity build is also using a groovy-jar of a Groovy build from this morning.
        Hide
        Hans Dockter added a comment -

        There is even a third way I can reproduce this bug. This is if I run it from IntelliJ.

        Show
        Hans Dockter added a comment - There is even a third way I can reproduce this bug. This is if I run it from IntelliJ.
        Hide
        blackdrag blackdrag added a comment -

        the only differences I can see is that you sue java1.5 on Mac and I am using 1.6 on Ubuntu. Maybe the issue is related to using a VM that is not a Sun VM? Maybe some Unsafe code crept in? Is it possible for you to check on a different platform?

        Show
        blackdrag blackdrag added a comment - the only differences I can see is that you sue java1.5 on Mac and I am using 1.6 on Ubuntu. Maybe the issue is related to using a VM that is not a Sun VM? Maybe some Unsafe code crept in? Is it possible for you to check on a different platform?
        Hide
        Hans Dockter added a comment -

        The bug occured on teamcity on the Linux as well as the Windows agent. The Windows agent is using Java 1.6. I'm not sure about the Linux Java version.

        Show
        Hans Dockter added a comment - The bug occured on teamcity on the Linux as well as the Windows agent. The Windows agent is using Java 1.6. I'm not sure about the Linux Java version.
        Hide
        Peter Niederwieser added a comment -

        I'm on Mac OS 10.5.2/Java 1.5.0_13, but I can't reproduce the problem. After making sure that the directories exist, both tests pass.

        Using the Groovy jar from the link above and Ant/JUnit from Gradle's lib directory, I've done the following:

        groovyc -cp .:./groovy-all-1.6-beta-1-SNAPSHOT.jar:./junit-4.4.jar:./ant-1.7.0.jar::./ant-launcher-1.7.0.jar G16BugTest.groovy
        java -cp .:./groovy-all-1.6-beta-1-SNAPSHOT.jar:./junit-4.4.jar:./ant-1.7.0.jar::./ant-launcher-1.7.0.jar G16BugTest

        Also I've manipulated my Groovy installation so that it uses the same Groovy jar for compilation.

        Show
        Peter Niederwieser added a comment - I'm on Mac OS 10.5.2/Java 1.5.0_13, but I can't reproduce the problem. After making sure that the directories exist, both tests pass. Using the Groovy jar from the link above and Ant/JUnit from Gradle's lib directory, I've done the following: groovyc -cp .:./groovy-all-1.6-beta-1-SNAPSHOT.jar:./junit-4.4.jar:./ant-1.7.0.jar::./ant-launcher-1.7.0.jar G16BugTest.groovy java -cp .:./groovy-all-1.6-beta-1-SNAPSHOT.jar:./junit-4.4.jar:./ant-1.7.0.jar::./ant-launcher-1.7.0.jar G16BugTest Also I've manipulated my Groovy installation so that it uses the same Groovy jar for compilation.
        Hide
        Jim White added a comment -

        Works for me with fresh build from trunk. Used JUnit 3.8.2 because that is what Groovy 1.6-beta-1 uses and don't have 4.4 handy.

        My output:

        > java -cp .:/$GROOVY_HOME/embeddable/groovy-all-1.6-beta-1-SNAPSHOT.jar:$GROOVY_HOME/lib/junit-3.8.2.jar:$GROOVY_HOME/lib/ant-1.7.0.jar:$GROOVY_HOME/lib/ant-launcher-1.7.0.jar G16BugTest
        ..
        Time: 0.531
        
        OK (2 tests)
        

        OS X 10.5.2, Dual G5

        Show
        Jim White added a comment - Works for me with fresh build from trunk. Used JUnit 3.8.2 because that is what Groovy 1.6-beta-1 uses and don't have 4.4 handy. My output: > java -cp .:/$GROOVY_HOME/embeddable/groovy-all-1.6-beta-1-SNAPSHOT.jar:$GROOVY_HOME/lib/junit-3.8.2.jar:$GROOVY_HOME/lib/ant-1.7.0.jar:$GROOVY_HOME/lib/ant-launcher-1.7.0.jar G16BugTest .. Time: 0.531 OK (2 tests) OS X 10.5.2, Dual G5
        Hide
        Jim White added a comment -

        Test as I ran it.

        Show
        Jim White added a comment - Test as I ran it.
        Hide
        Peter Niederwieser added a comment -

        Not sure if this helps but:
        Building ("gradle libs") gradle svn head with gradle 0.1.3 succeeds. But when I replace either gradle's lib/groovy-all-1.5.5.jar with a Groovy jar built from 1.6 trunk, I get tons of InvokerInvocationException's.

        Show
        Peter Niederwieser added a comment - Not sure if this helps but: Building ("gradle libs") gradle svn head with gradle 0.1.3 succeeds. But when I replace either gradle's lib/groovy-all-1.5.5.jar with a Groovy jar built from 1.6 trunk, I get tons of InvokerInvocationException's.
        Hide
        Hans Dockter added a comment -

        This had been the next thing I would have asked for. Because this is my original problem and its good to know that it is reproducible. I had a closer look at the tests which failed and came up with the ones above to reproduce the problems in an easy way. Its strange that those tests only fail for me. I gonna have a fresh look at this tomorrow.

        Thanks

        • Hans
        Show
        Hans Dockter added a comment - This had been the next thing I would have asked for. Because this is my original problem and its good to know that it is reproducible. I had a closer look at the tests which failed and came up with the ones above to reproduce the problems in an easy way. Its strange that those tests only fail for me. I gonna have a fresh look at this tomorrow. Thanks Hans
        Hide
        blackdrag blackdrag added a comment -

        any updates on this?

        Show
        blackdrag blackdrag added a comment - any updates on this?
        Hide
        blackdrag blackdrag added a comment -

        I am closing this for now... If Hans can reprodcue the issue with beta2, then please repoen it.

        Show
        blackdrag blackdrag added a comment - I am closing this for now... If Hans can reprodcue the issue with beta2, then please repoen it.

          People

          • Assignee:
            blackdrag blackdrag
            Reporter:
            Hans Dockter
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: