I have a service call that returns a JSON response which is then passed through a data manager that transforms the data if service is success or creates an error body if the call is a failure.
The data manager is written in kotlin and the particular line of code i am interested in is this
val mutableList = mutableListOf<Address>()
return Result.error(errorTransformation(serviceErrors, mutableList))
My errorTransformation class is basically an Exception call and this is written java. The constructor for the exception class is
ExceptionClass(ServiceErrors serviceError ,List<Address> address){
// initiialize fields here
}
Now When i try to initialize my exception class it says appropriate constructor is found and it is showing me a suggestion to generate one with syntax
ExceptionClass(ServiceErrors serviceError ,List<? extends Address> address){
// initiialize fields here
}
Why is this happening? I only want List<Address>
, not List<? extends Address>
.
val mutableList = ArrayList<Address>()
? – Agustinaah