hi all. I have a kotlin function that returns a value of type Result. I call this function from java code. In java code I want to use methods of that returned Result value to check whether the result was success, but java thinks that my function returns an Object. From the source code of Result, it is an inlined class wrapped around the type Any? which is probably represented in java as an object. According to the inline documentation, at runtime it will be represented as Object then. I guess that’s why the return value is perceived as Object in the java code. Not sure if it’s possible to “uninline” the type.
09/28/2023, 2:21 PM
Don’t use the Result type from the stdlib, it’s not intended for use in app code. Create your own Result sealed class.
09/29/2023, 7:53 PM
is it a good practice to store the exception in the Failed Result?