I have a method that makes api call:
public def getInfo(String A, String B, String C, String D, String E) {
def response = null;
def requestHeaders = ['A': A, 'B' : B]
requestHeaders << headers
Map uriVariables = [C : C, D : D, start: 1, end: 10, E: E]
try {
response = restMethod.get(getInfo, uriVariables, requestHeaders, [:])
if(!response) {
return null;
}
} catch (e) {
logger.error("Error getting data", e)
}
return response?.data ? response?.data : null
}
Then I wrote another function to test that api call locally from SwaggerUI
@CrossOrigin
@RequestMapping(method = RequestMethod.GET, path = '/getInfo')
def getInfoTest(@RequestHeader('A') String A, @RequestHeader('B') String B, @RequestHeader('C') String C, @RequestHeader('D') String D, @RequestHeader('E') String E) {
infoResponse = InfoRestClient.getInfo(A, B, C, D, E)
return infoResponse
}
Somehow when I ran the call, I got this error:
groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.util.LinkedHashMap#LleftShift.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[interface java.util.Map]
[interface java.util.Map$Entry]
I tried to work around with the parameters for the getInfoTest, but it all returns to the same error. I've checked and some older posts say this error is caused because of different functions with the same name, but I only got 1 function with such name. Has anyone got similar issue and how did you solve it? Thank you so much in advance!