title: Groovy ambiguous method overload
body: <p>Morning all - I see that similar questions have been asked a couple of times, but they all seem to be for compiled projects or those involving Gradle. Anyway, I'm getting the error</p>
  
  <pre><code>Caused by: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.math.BigDecimal#&lt;init&gt;.
  Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
  [class [C]
  [class java.lang.String]
  </code></pre>
  
  <p>when I run this little script</p>
  
  <pre><code>String amt = "1"
  String currency = "GBP"
  String targetCurrency = "USD"
  
  def settlement = crossCurrencyClient.crossCurrency(amt, currency, targetCurrency)
  
  return transfer.amount * new java.math.BigDecimal (settlement)
  </code></pre>
  
  <p>which itself triggers this</p>
  
  <pre><code>import groovyx.net.http.HTTPBuilder
  import groovyx.net.http.RESTClient
  import groovy.json.JsonBuilder
  import groovy.json.JsonOutput
  import static groovyx.net.http.Method.GET
  import static groovyx.net.http.ContentType.JSON
  
  public class CrossCurrencyClient {
  
      def issuingAddress = "rBycsjqxD8RVZP5zrrndiVtJwht7Z457A8"
      String source = "rUR5QVHqFxRa8TSQawc1M6jKj7BvKzbHek" 
      String multiplier = ""
      def resURL = "http://url-string.com/v1/"
      def resourceIdClient = new RESTClient("${resURL}")
  
      public String generateUUID() {
          def resourceId = resourceIdClient.get(path:"uuid").data.uuid
          println "resourceId = " + resourceId
          return resourceId
          }
  
      public String crossCurrency(String amt,String currency,String targetCurrency) {
  
          def http = new HTTPBuilder( "${resURL}accounts/${source}/payments/paths/${source}/${amt}+${targetCurrency}+${issuingAddress}?source_currencies=${currency}+${issuingAddress}" 
  )
  
          http.request(GET,JSON) {
  
              response.success = { resp, json -&gt; 
                  if(json.success){
                      multiplier = json?.source_amount?.value
                  }
              }
  
              response.failure = { resp -&gt;
                  println "Request failed with status ${resp.status} and message : ${resp.message}"
                  return "Something went wrong"
              }
          }
      return multiplier    
      }
  }
  
  CrossCurrencyClient crossCurrencyClient = new CrossCurrencyClient()
  </code></pre>
  
  <p>I can't work out what the problem is here. As far as I can see all the methods are done properly and there is no ambiguity. Can anyone point to where I'm going wrong?</p>