groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method org.codehaus.groovy.runtime.HandleMetaClass#getMetaMethod. Cannot resolve which method to invoke for {class java.lang.String} due to overlapping prototypes between: {class java.lang.String, class [Ljava.lang.Object;} {class java.lang.String, class [Ljava.lang.Class;}

Apache's JIRA Issue Tracker | James Parkin | 8 years ago
  1. 0

    Running the following code cause an Ambiguous method overloading exception: str = 'hello' methodName = 'toUpperCase' methodOfInterest = str.metaClass.getMetaMethod(methodName) println methodOfInterest.invoke(str) Expected output: HELLO Exception details: Exception in thread "main" groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method org.codehaus.groovy.runtime.HandleMetaClass#getMetaMethod. Cannot resolve which method to invoke for {class java.lang.String} due to overlapping prototypes between: {class java.lang.String, class [Ljava.lang.Object;} {class java.lang.String, class [Ljava.lang.Class;} at groovy.lang.MetaClassImpl.chooseMostSpecificParams(MetaClassImpl.java:2866) at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2819) at groovy.lang.MetaClassImpl.getNormalMethodWithCaching(MetaClassImpl.java:1228) at groovy.lang.MetaClassImpl.getMethodWithCaching(MetaClassImpl.java:1131) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:736) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:719) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:163) at MOPUsingMetaMethod.run(MOPUsingMetaMethod.groovy:4) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1061) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:736) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:719) at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:381) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234) at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1301) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:710) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:163) at MOPUsingMetaMethod.main(MOPUsingMetaMethod.groovy) This functionality does work in groovy 1.5.7 so appears to have regressed in 1.6.0. Using the pickMethod instead of getMetaMethod produces the expected output.

    Apache's JIRA Issue Tracker | 8 years ago | James Parkin
    groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method org.codehaus.groovy.runtime.HandleMetaClass#getMetaMethod. Cannot resolve which method to invoke for {class java.lang.String} due to overlapping prototypes between: {class java.lang.String, class [Ljava.lang.Object;} {class java.lang.String, class [Ljava.lang.Class;}
  2. 0

    Running the following code cause an Ambiguous method overloading exception: str = 'hello' methodName = 'toUpperCase' methodOfInterest = str.metaClass.getMetaMethod(methodName) println methodOfInterest.invoke(str) Expected output: HELLO Exception details: Exception in thread "main" groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method org.codehaus.groovy.runtime.HandleMetaClass#getMetaMethod. Cannot resolve which method to invoke for {class java.lang.String} due to overlapping prototypes between: {class java.lang.String, class [Ljava.lang.Object;} {class java.lang.String, class [Ljava.lang.Class;} at groovy.lang.MetaClassImpl.chooseMostSpecificParams(MetaClassImpl.java:2866) at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2819) at groovy.lang.MetaClassImpl.getNormalMethodWithCaching(MetaClassImpl.java:1228) at groovy.lang.MetaClassImpl.getMethodWithCaching(MetaClassImpl.java:1131) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:736) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:719) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:163) at MOPUsingMetaMethod.run(MOPUsingMetaMethod.groovy:4) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1061) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892) at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:736) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:719) at org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:381) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234) at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1301) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:710) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:163) at MOPUsingMetaMethod.main(MOPUsingMetaMethod.groovy) This functionality does work in groovy 1.5.7 so appears to have regressed in 1.6.0. Using the pickMethod instead of getMetaMethod produces the expected output.

    Apache's JIRA Issue Tracker | 8 years ago | James Parkin
    groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method org.codehaus.groovy.runtime.HandleMetaClass#getMetaMethod. Cannot resolve which method to invoke for {class java.lang.String} due to overlapping prototypes between: {class java.lang.String, class [Ljava.lang.Object;} {class java.lang.String, class [Ljava.lang.Class;}
  3. 0

    Groovy - How do I use metaprogramming to add tracing to all static methods of a class? - groovy answers

    ask-coder.com | 1 year ago
    groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method org.codehaus.groovy.runtime.HandleMetaClass#getStaticMetaMethod.|Cannot resolve which method to invoke for [class java.lang.String, null] due to overlapping prototypes between:|?[class java.lang.String, class [Ljava.lang.Object;]|?[class java.lang.String, class [Ljava.lang.Class;]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Groovy - How do I use metaprogramming to add tracing to all static methods of a class?

    Stack Overflow | 6 years ago | Kyle
    groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method org.codehaus.groovy.runtime.HandleMetaClass#getStaticMetaMethod.|Cannot resolve which method to invoke for [class java.lang.String, null] due to overlapping prototypes between:|?[class java.lang.String, class [Ljava.lang.Object;]|?[class java.lang.String, class [Ljava.lang.Class;]
  6. 0

    DSTConfig - modoverrides.lua generation tool for servers - [Don't Starve Together - BETA] Dedicated Server Discussion - Klei Entertainment Forums

    kleientertainment.com | 9 months ago
    org.luaj.vm2.LuaError: script:17 vm error: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method info.inpureprojects.DSTConfig.LuaManager#load. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class java.io.File] [class java.io.InputStream] [class java.lang.String]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. groovy.lang.GroovyRuntimeException

      Ambiguous method overloading for method org.codehaus.groovy.runtime.HandleMetaClass#getMetaMethod. Cannot resolve which method to invoke for {class java.lang.String} due to overlapping prototypes between: {class java.lang.String, class [Ljava.lang.Object;} {class java.lang.String, class [Ljava.lang.Class;}

      at groovy.lang.MetaClassImpl.chooseMostSpecificParams()
    2. Groovy
      ScriptBytecodeAdapter.invokeMethodN
      1. groovy.lang.MetaClassImpl.chooseMostSpecificParams(MetaClassImpl.java:2866)
      2. groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2819)
      3. groovy.lang.MetaClassImpl.getNormalMethodWithCaching(MetaClassImpl.java:1228)
      4. groovy.lang.MetaClassImpl.getMethodWithCaching(MetaClassImpl.java:1131)
      5. groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:910)
      6. groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
      7. org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:736)
      8. org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:719)
      9. org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:163)
      9 frames
    3. Unknown
      MOPUsingMetaMethod.run
      1. MOPUsingMetaMethod.run(MOPUsingMetaMethod.groovy:4)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    5. Groovy
      InvokerHelper.runScript
      1. org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
      2. groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
      3. groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1061)
      4. groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
      5. org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:736)
      6. org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:719)
      7. org.codehaus.groovy.runtime.InvokerHelper.runScript(InvokerHelper.java:381)
      7 frames
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    7. Groovy
      ScriptBytecodeAdapter.invokeMethodN
      1. org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
      2. groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
      3. groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1301)
      4. org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:710)
      5. org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:163)
      5 frames
    8. Unknown
      MOPUsingMetaMethod.main
      1. MOPUsingMetaMethod.main(MOPUsingMetaMethod.groovy)
      1 frame