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

Method Overload with Primitive Array Parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-10
    • 1.0-beta-10
    • None
    • None
    • Windows, Linux

    Description

      class RetrieveMethodTest1 extends GroovyTestCase {

      void testRetrieveMethod() {
      println("")
      someMethod(new int[]

      {1, 2, 3, 4}

      )
      }

      someMethod(int[] arr)

      { println("int[]: " + arr[arr.length - 1]) }

      someMethod(double[] arr)

      { println("double[]: " + arr[arr.length - 1]) }

      }

      /*****************************************************
      Test Date: 2005/01/31
      Test Version: groovy-1.0-beta-10-cvs
      Test Environment: Windows XP & JDK 1.4.2_06-b03
      C:\test> groovy RetrieveMethodTest1.groovy
      .
      E
      Time: 0.02
      There was 1 error:
      1) testRetrieveMethod(RetrieveMethodTest1)groovy.lang.GroovyRuntimeException: fa
      iled to invoke method: org.codehaus.groovy.runtime.ReflectionMetaMethod@73a34b[n
      ame: someMethod params: [class [D] returns: class java.lang.Object owner: class
      RetrieveMethodTest1] on: testRetrieveMethod(RetrieveMethodTest1) with arguments:
      [[1, 2, 3, 4]] reason: java.lang.IllegalArgumentException: argument type mismat
      ch
      at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1507)
      at groovy.lang.MetaClass.invokeMethod(MetaClass.java:321)
      at groovy.lang.MetaClass.invokeMethod(MetaClass.java:304)
      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:143)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.
      java:95)
      at RetrieveMethodTest1.testRetrieveMethod(D:\test\groovy\primitive\Retri
      eveMethodTest1.groovy:5)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at org.codehaus.groovy.runtime.ReflectionMetaMethod.invoke(ReflectionMet
      aMethod.java:67)
      at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1442)
      at groovy.lang.MetaClass.invokeStaticMethod(MetaClass.java:498)
      at org.codehaus.groovy.runtime.Invoker.invokeStaticMethod(Invoker.java:1
      69)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeStaticMethod(InvokerH
      elper.java:110)
      at groovy.lang.GroovyShell.runTest(GroovyShell.java:319)
      at groovy.lang.GroovyShell.runMainOrTestOrRunnable(GroovyShell.java:263)

      at groovy.lang.GroovyShell.run(GroovyShell.java:235)
      at groovy.lang.GroovyShell.run(GroovyShell.java:163)
      at groovy.ui.GroovyMain.processOnce(GroovyMain.java:372)
      at groovy.ui.GroovyMain.run(GroovyMain.java:234)
      at groovy.ui.GroovyMain.process(GroovyMain.java:220)
      at groovy.ui.GroovyMain.main(GroovyMain.java:124)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:461)
      Caused by: java.lang.IllegalArgumentException: argument type mismatch
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at org.codehaus.groovy.runtime.ReflectionMetaMethod.invoke(ReflectionMet
      aMethod.java:67)
      at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1442)
      ... 45 more

      FAILURES!!!
      Tests run: 1, Failures: 0, Errors: 1
      *****************************************************/

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            phkim Kim, Pilho
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: