I searched StackOverflow before posting this question but I wasn't able to find the right answer. Sorry if this is a repost. My problem is this:
I have a method that is overloaded in my java class:
class ABC{
public boolean doSomething(String path, ArrayList<SomeObject> objList){
// calling the method below in a loop
}
public boolean doSomething(String path, SomeObject obj){
// Some code here
}
}
I'm calling the above class from my groovy code like this:
void performDoSomething(ABC abc, String path, String[] strList){
def list = []
for (str in strList) {
SomeObject sObj = new SomeObject(str) // EDIT: sorry I missed this line before
list.add(sObj)
}
if (abc) abc.doSomething(path, list)
}
The problem is that the groovy compiler is calling the abc.doSomething(String str, SomeObject obj) method instead of abc.doSomething(String str, ArrayList objList) method.
I'm using eclipse IDE with grails plugin (STS) and this is part of a bigger grails project (our company has a lot of legacy code in java).
Any ideas on how to fix this?
Thank you for your time!
EDIT: I have tried abc.doSomething(path, list as ArrayList) too but I'm getting the same result..
String[]into anArrayList<Object>? - user207421