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

Ambiguous method overloading

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-4
    • 1.0-beta-6
    • None
    • None
    • mac os x (panther) beta-4 with latest snapshot jar, jdk 1.4.2

    Description

      Running either of these code fragments causes the error shown:

      import java.awt.Color;
      int i = 1;
      Color c = new Color(i, i, i);

      import java.awt.Color;
      Color c = new Color(1, 2, 3);

      Caught: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method: <init>. Cannot resolve which method to invoke due to overlapping prototypes between: [float, float, float] and: [int, int, int]
      groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method: <init>. Cannot resolve which method to invoke due to overlapping prototypes between: [float, float, float] and: [int, int, int]
      at groovy.lang.MetaClass.checkForInvalidOverloading(MetaClass.java:1282)
      at groovy.lang.MetaClass.chooseMostSpecificParams(MetaClass.java:1256)
      at groovy.lang.MetaClass.chooseMethod(MetaClass.java:1187)
      at groovy.lang.MetaClass.invokeConstructor(MetaClass.java:405)
      at org.codehaus.groovy.runtime.Invoker.invokeConstructorOf(Invoker.java:159)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:133)
      at test.run(test.groovy:4)

      Attachments

        Activity

          People

            Unassigned Unassigned
            backspaces Owen Densmore
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: