What happened and how can we reproduce this issue?
Environment info
KMM library that contains ktorfit API (Kotlin 1.7.20)
Multimodule Android app (Java) that consumes KMM library
Steps to reproduce
Create an API created by the library that can be accessed by the android app (using CallResponseConverter)
Call the API method
Note the following behavior when comparing the response code equality
LOGGER.debug("mike-log - response val [{}] - ok val[{}] - equals[{}]",
httpResponse.getStatus().getValue(),
HttpStatusCode.Companion.getOK().getValue(),
(httpResponse.getStatus() == HttpStatusCode.Companion.getOK()));
LOGGER.debug("mike-log - equals 1: {}", HttpStatusCode.Companion.getOK().equals(httpResponse.getStatus()));
LOGGER.debug("mike-log - equals 2: {}", httpResponse.getStatus().equals(HttpStatusCode.Companion.getOK()));
LOGGER.debug("mike-log - is same class 1: {}", httpResponse.getStatus() instanceof HttpStatusCode);
LOGGER.debug("mike-log - is same class 2: {}", HttpStatusCode.Companion.getOK() instanceof HttpStatusCode);
LOGGER.debug("mike-log - val equals {}", HttpStatusCode.Companion.getOK().getValue() == httpResponse.getStatus().getValue());
produces
DEBUG mike-log - response val [200] - ok val[200] - equals[false]
DEBUG mike-log - equals 1: true
DEBUG mike-log - equals 2: true
DEBUG mike-log - is same class 1: true
DEBUG mike-log - is same class 2: true
DEBUG mike-log - val equals true
I'm not sure why, but == seems to fail when .equals() works. I'm unsure if this is a KMM thing or related to the class HttpStatusCode but I figured I'd bring this to the project's attention.
What did you expect to happen?
I would expect that == and .equals() would work in the same manner.
Ktorfit version
1.0.0
What happened and how can we reproduce this issue?
Environment info
Steps to reproduce
produces
DEBUG mike-log - response val [200] - ok val[200] - equals[false] DEBUG mike-log - equals 1: true DEBUG mike-log - equals 2: true DEBUG mike-log - is same class 1: true DEBUG mike-log - is same class 2: true DEBUG mike-log - val equals true
I'm not sure why, but
==
seems to fail when.equals()
works. I'm unsure if this is a KMM thing or related to the classHttpStatusCode
but I figured I'd bring this to the project's attention.What did you expect to happen?
I would expect that
==
and.equals()
would work in the same manner.Is there anything else we need to know about?
No response