Closed Rdornier closed 1 year ago
Is this in a Groovy script in Fiji?
It is weird, because there is a delete
method for GenericObjectWrapper objects (and subclasses):
https://github.com/GReD-Clermont/simple-omero-client/blob/main/src/main/java/fr/igred/omero/Client.java#L187
It looks as if the method called is GatewayWrapper::delete
instead of Client::delete
, but a method with the appropriate signature exists...
Yes, it is in a groovy script in Fiji.
Ok. I'm not sure but I think it is caused by type erasure in Groovy and the fact it uses the runtime type (and not the declared type) to determine which method should be used.
For Groovy, ROI_list
is a List
of something, and GatewayWrapper::delete
is the method with a List
parameter.
Casting the argument in the call seems to work:
user_client.delete((Collection<ROIWrapper>) ROI_list);
The alternative would be to rename the methods so they have a distinct name, but that's not really a solution.
user_client.delete((Collection<ROIWrapper>) ROI_list);
I works fine, thanks.
The alternative would be to rename the methods so they have a distinct name, but that's not really a solution.
I agree, having a distinct name is not really helpful. In fact, I think the problem here is more groovy than method' name.
Bug report
Description
Throws an error when trying to delete a list of ROIWrapper() using the
delete(Collection<? extends GenericObjectWrapper<?>> objects)
method inClient
classThe follwing script generates the follwing error
However, if I do the cast to IObject manually from ROIWrapper (and not from GenericObjectWrapper), then it does not throw any errors and delete all ROIs. The code snippet below works fine.
Error thrown
Expected results
Having the possibility to use directly client.delete() with a list of ROIWrappers
Version of the software
Tested on 5.9.2 and 5.12.2 => give the same error.